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

doing explain on $query on the shell returns error 'bad query'

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.5.1
    • Component/s: None
    • None
    • ALL

      > db.test.find({$query: {random: -14 } }).explain()
      Fri Jul 26 16:51:50.251 error: {
      	"$err" : "bad query: BadValue unknown top level operator: $query",
      	"code" : 16810
      } at src/mongo/shell/query.js:131
      
      > db.test.getIndexes()
      [
      	{
      		"v" : 1,
      		"key" : {
      			"_id" : 1
      		},
      		"ns" : "test.test",
      		"name" : "_id_"
      	}
      ]
      
      Fri Jul 26 16:51:07.277 [initandlisten] MongoDB starting : pid=81884 port=27017 dbpath=/data/db/ 64-bit host=Gianfranco-10gen.local
      Fri Jul 26 16:51:07.277 [initandlisten]
      Fri Jul 26 16:51:07.277 [initandlisten] ** NOTE: This is a development version (2.5.1) of MongoDB.
      Fri Jul 26 16:51:07.277 [initandlisten] **       Not recommended for production.
      Fri Jul 26 16:51:07.277 [initandlisten]
      Fri Jul 26 16:51:07.277 [initandlisten] db version v2.5.1
      Fri Jul 26 16:51:07.278 [initandlisten] git version: dd226d98a53286a5af892f0b81a5252dd62f7444
      Fri Jul 26 16:51:07.278 [initandlisten] build info: Darwin bs-osx-106-x86-64-2.10gen.cc 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun  7 16:32:41 PDT 2011; root:xnu-1504.15.3~1/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49
      

      https://github.com/mongodb/mongo/blob/r2.5.1/src/mongo/shell/query.js#L131

      The only change I can see in that portion of code is:

      SERVER-10134 Report errors during GetMore processing
      This is necessary for SERVER-5932 (aggregation returning cursors)

      https://github.com/mongodb/mongo/commit/0f43cfcbe063c1f4615ce362e751155218224bec

            Assignee:
            Unassigned Unassigned
            Reporter:
            gianfranco Gianfranco Palumbo
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: