How To Create Ttl Index On Long Timestamp In Mongodb
In my mongo database I have field timestamp which holds time of creation in timestamp ie: 'timestamp': 1544029233021 I want to create TTL index on this field, but in docs example i
Solution 1:
The documents aren't being expired because the timestamp
value is an integer.
TTL indexes will only work on documents where the indexed field is a Date or holds an array of Dates:
If the indexed field in a document is not a date or an array that holds a date value(s), the document will not expire.
(https://docs.mongodb.com/manual/core/index-ttl/#expiration-of-data)
Post a Comment for "How To Create Ttl Index On Long Timestamp In Mongodb"