0

I know that the TTL index in MongoDB set a time to live for its documents. When they live for the specified time then those documents gets deleted. So what if I want to archive those documents without losing them. is there any way to do it? I am sorry If I asked it in the wrong place.

2 Answers2

0

You can use a change stream to capture documents inserted and archive them somewhere. See also this answer on stackoverflow.

Joe Drumgoole
  • 1,268
  • 9
  • 9
0

At the start you have a document with "column" (timestamp) that is in the TTL index. To prevent its deletion, you can move that timestamp to the future, or remove that "column" from the document.

JJussi
  • 1,540
  • 12
  • 12