How to create a TTL index on a collection

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: 1.0.4
    • Component/s: Core API
    • None
    • Environment:
      macOS/Ubuntu
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      How can I go about doing something like what is defined here: https://docs.mongodb.com/manual/tutorial/expire-data/ using Go MongoDB driver?

      I presume I would have to do this at the collection level. It doesn't seem like I can use RunCommand on a collection object.

       

      The specific command I am trying to run would be `db.log_events.createIndex(

      { "createdAt": 1 }

      ,

      { expireAfterSeconds: 3600 }

      )`.

            Assignee:
            Divjot Arora (Inactive)
            Reporter:
            Andrew Lee
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: