Is it possible to create a complex index based on both partialFilterExpression and expireAfterSeconds?
I would like to have a TTL-based clean up, but I also want to perform it only for some records.
I have tried creating such an index with a command:
db.expirational.createIndex(
{ created_on : 1 },
{ expireAfterSeconds : 20, partialFilterExpression: { rating: 2 } }
)
My records are like: db.expirational.insert({ 'name': 'record4', 'rating' : 1, 'created_on' : new Date() })
TTL part works and cleans up the colelction, but it doesn't care about partialFilterExpression: { rating: 2 }.
Is it expected? Is my command incorrect? If not, should we create a feature request? I find such a usecase very useful.