Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-1218

How to create a TTL index on a collection

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

      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@mongodb.com Divjot Arora (Inactive)
            Reporter:
            ajlee1000 Andrew Lee
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: