-
Type: Bug
-
Resolution: Done
-
Priority: 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.