Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-42117

Bad hint (json order)

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Querying
    • None
    • Server Triage
    • ALL

      I have created a collection having a compound index, as :

      db.ConnectedobjectValue.getIndexes()[{ "v" : 2, "key" : { "entryDate" : -1, "idParameter" : -1, "idConnectedobject" : -1 }, "name" : "entryDate_-1_idParameter_-1_idConnectedobject_-1", "ns" : "DB.ConnectedobjectValue", "background" : true }]
      

      Then I tried to perform a simple find using this compound index :

      db.ConnectedobjectValue.find({}).hint({ entryDate: -1, idConnectedobject: -1, idParameter: -1 })
      

      And I got the following error :

      Error: error: {Error: error: { "ok" : 0, "errmsg" : "error processing query: ns=ELIOT.ConnectedobjectValueTree: $and\nSort: {}\nProj: {}\n planner returned error: bad hint", "code" : 2, "codeName" : "BadValue"}
      

      I have found that changing the order of the names in my find request make it to work :

      db.ConnectedobjectValue.find({}).hint({ entryDate: -1, idParameter: -1, idConnectedobject: -1 })
      

      Which is non sense considering that json do not guarantee keys order.

        1. ids.png
          ids.png
          107 kB

            Assignee:
            backlog-server-triage [HELP ONLY] Backlog - Triage Team
            Reporter:
            orelsanpls Grégory NEUT
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: