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.
CodePudding user response:
You can use a change stream to capture documents inserted and archive them somewhere. See also this answer on stackoverflow.
CodePudding user response:
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.
