1

I have a collection in cosmos db and I need to implement TTL based on its "expiration" field, which is a date. My documents should expire 7 days post the expiration date. According to documentation, cosmos db api limits the ability to do so. I want to achieve something like below for my collection. How can I do that?

db.collection.createIndex(
    {
        Expiration: 1
    },
    {
        name: "Expiration_1",
        expireAfterSeconds: 604800
    }
);
David Makogon
  • 69,407
  • 21
  • 141
  • 189
Rashnee
  • 11
  • 1
  • This is not supported today but it is something that is coming down the road. Can't share a date but not too far off. – Mark Brown Mar 08 '22 at 19:46

0 Answers0