ruby - Why can't I see TTL from db.my_collection.getIndex() output? -
i have index expireafterseconds
set. how confirm using cli when output of db.my_collection.getindexes()
shows this:
{ "v": 1, "key": { "last_used_at": 1 }, "name": "last_used_at_1", "ns": "cms.user_sessions" }
it looks normal index without expireafterseconds
set.
how can confirm index created expireafterseconds
?
here's ruby code creates index. have tried dropping index , recreating using code several times.
@user_sessions.indexes.create_many([ {key: {token: 1}, unique: true}, {key: {last_used_at: 1}, expireafterseconds: ttl} ])
version information:
$ mongod --version db version v2.6.5 2016-07-13t16:11:45.844+0200 git version: e99d4fcb4279c0279796f237aa92fe3b64560bf6 $ gem list | grep mongo mongo (2.2.5)
there issue index, try drop , recreate.
when ttl set db.name.getindexes()
command
[ { "v" : 1, "key" : { "_id" : 1 }, "name" : "_id_", "ns" : "test.eventlog" }, { "v" : 1, "key" : { "lastmodifieddate" : 1.0 }, "name" : "lastmodifieddate_1", "ns" : "test.eventlog", "expireafterseconds" : 3600.0 } ]
Comments
Post a Comment