How to specify the life time of the posts with a specific field?

Good day, there's a pattern of posts where there is a field inTrash: Boolean.
And there is such a feature Mongi docs.mongodb.org/manual/tutorial/expire-data
How to apply it not to all posts of the collection, but only for post with a field 'inTrash':true (it will be set by the moderator. )?
September 19th 19 at 13:35
1 answer
September 19th 19 at 13:37
Solution
Here, put.
: And what hinders at the time of adding the field inTrash add and expireAt field? - Christa.Kiehn commented on September 19th 19 at 13:43
Yes, but not for the entire collection, and for posts with a field 'inTrash':true?
Post.ensureIndex( { "expireAt": 1, "inTrash": true }, { expireAfterSeconds: 0 } ) ? So? - Weldon.Simoni commented on September 19th 19 at 13:40
All right. Create a field with the date deleted, by default it is empty when deleting a record to put the date and it will be removed either at this date or vasagatan+expireAfterSeconds. - flavie_Spencer commented on September 19th 19 at 13:46

Find more questions by tags MongoDBJavaScriptNode.jsDatabases