1

I'm trying to create a TTL index using mongo db compass.

My document is as follows

enter image description here

I created the following index in mongo db compass. enter image description here

But the ttl index doesn't seem to take effect on the existing or the new entries in the document.

Community
  • 1
  • 1
usr30911
  • 2,731
  • 7
  • 26
  • 56

1 Answers1

0

What version of Compass are you using?

I tried that with a field of type Date and it worked well: the document was gone after the TTL expired. Have you checked in the shell if the index is properly created with a TTL? You should see something like this:

> db.boo.getIndexes()
[
    {
        "v" : 2,
        "key" : {
            "_id" : 1
        },
        "name" : "_id_",
        "ns" : "test.boo"
    },
    {
        "v" : 2,
        "key" : {
            "date" : 1
        },
        "name" : "date_1",
        "ns" : "test.boo",
        "background" : false,
        "expireAfterSeconds" : 600
    }
]