Time-series commands with string hint on _id succeeds even without an _id index

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Critical - P2
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Integration
    • ALL
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Commands that specify a string value of 

      "_id_"

       (the name of the id index) for the "hint" option succeed when they should fail on timeseries collections. Timeseries is a type of clustered collection. Even though clustered collections do have an index on _id by default, for timeseries, that _id index is on the buckets coll and not the user-facing coll so these types of commands with hints on _id should fail for timeseries.

      Ex: 

      db.adithiTS.find({x: {$gt: 2}}).hint("_id_")
      db.adithiTS.deleteMany({x: {$gt: 2}}, {hint: "_id_"})

      or 

      db.runCommand({ find: "adithiTS", hint: "_id_" }) 
      db.runCommand({ delete: "adithiTS", deletes: [{q: {x: {$gt: 2}}, limit: 0, hint: "_id_" }]})

      I only tested the find/delete commands but this likely affects all commands that have a "hint" option (ex: bulkWrite, findAndModify, update, etc.). The inclusion of the hint: "id" option doesn't appear to affect the expected results in my preliminary testing.

      These commands (with string hint: "id") pass on the latest stable versions for 6.0, 7.0, 8.0, and on master. When the hint has an object value, like hint: {_id: 1}, the commands fail as expected with 

      planner returned error :: caused by :: hint provided does not correspond to an existing index 

       

            Assignee:
            Adithi Raghavan
            Reporter:
            Yuhong Zhang
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: