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