ttl nodejs mongodb code example
Example: mongodb conditional expire
let keys = { lastModifiedDate: -1 };
let options = {
expireAfterSeconds: 3600,
partialFilterExpression: { pending: true }
};
db.getCollection("collection").createIndex(keys, options);