I followed this article - https://docs.mongodb.com/manual/tutorial/expire-data/
I created the index on atlas first. It was added successfully. But the documents weren’t deleted as per expiry.
I used the same method on localhost mongo shell, and it worked fine.
I added this index
{ "expiresAt": 1 }, { expireAfterSeconds: 0 }
where expiresAt
is a Date object in my document.
This is the document I expected to be deleted.
_id :5f55f440058cdd3754907255
name :"first"
language :"Plain Text"
content :"Some text"
createdAt :2020-09-07T08:50:08.708+00:00
expiresAt :2020-09-07T08:51:08.709+00:00
__v :0