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

hint by index name breaks with explain()

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: 2.7.8
    • Fix Version/s: 3.0.0-rc6
    • Component/s: Querying
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL

      Description

      test@local(2.8.0-rc4) > db.foo.getIndexes()
      [
      	{
      		"v" : 1,
      		"key" : {
      			"_id" : 1
      		},
      		"name" : "_id_",
      		"ns" : "test.foo"
      	},
      	{
      		"v" : 1,
      		"key" : {
      			"a" : 1
      		},
      		"name" : "a_1",
      		"ns" : "test.foo"
      	}
      ]
      test@local(2.8.0-rc4) > db.foo.find({a:1})
      { "_id" : ObjectId("54b588d2d7a7afb83a377935"), "a" : 1 }
      test@local(2.8.0-rc4) > db.foo.find({a:1}).hint("a_1")
      { "_id" : ObjectId("54b588d2d7a7afb83a377935"), "a" : 1 }
      test@local(2.8.0-rc4) > db.foo.find({a:1}).hint("a_1").explain()
      2015-01-13T16:07:09.059-0500 I QUERY    Error: explain failed: {
      	"ok" : 0,
      	"errmsg" : "error processing query: ns=test.foo limit=0 skip=0\nTree: a == 1.0\nSort: {}\nProj: {}\n planner returned error: bad hint",
      	"code" : 2
      }
          at Error (<anonymous>)
          at Function.throwOrReturn (src/mongo/shell/explainable.js:34:19)
          at constructor.finish (src/mongo/shell/explain_query.js:188:36)
          at DBQuery.explain (src/mongo/shell/query.js:434:25)
          at (shell):1:32 at src/mongo/shell/explainable.js:34
      test@local(2.8.0-rc4) > db.foo.find({a:1}).hint("a_1").explain(true)
      2015-01-13T16:07:10.756-0500 I QUERY    Error: explain failed: {
      	"ok" : 0,
      	"errmsg" : "error processing query: ns=test.foo limit=0 skip=0\nTree: a == 1.0\nSort: {}\nProj: {}\n planner returned error: bad hint",
      	"code" : 2
      }
          at Error (<anonymous>)
          at Function.throwOrReturn (src/mongo/shell/explainable.js:34:19)
          at constructor.finish (src/mongo/shell/explain_query.js:188:36)
          at DBQuery.explain (src/mongo/shell/query.js:434:25)
          at (shell):1:32 at src/mongo/shell/explainable.js:34

      So hint by name works, but with explain() appended it breaks.

        Attachments

          Activity

            People

            Assignee:
            rassi J Rassi
            Reporter:
            asya Asya Kamsky
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: