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

explain() doesn't work with $min / $max

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

      The following query runs successfully on 2.6.3, but explains doesn't allow $min / $max.

      > db.bar.ensureIndex({ a: 1})
      {
      	"createdCollectionAutomatically" : true,
      	"numIndexesBefore" : 1,
      	"numIndexesAfter" : 2,
      	"ok" : 1
      }
      > db.bar.insert({a: 100})
      WriteResult({ "nInserted" : 1 })
      > db.bar.find({ $min: { a: 1}, $query: {} })
      { "_id" : ObjectId("53c553de010c89b3b2c76040"), "a" : 100 }
      > db.bar.find({ $max: { a: 1}, $query: {} }).explain()
      2014-07-15T12:09:53.686-0400 error: {
      	"$err" : "Can't canonicalize query: BadValue unknown top level operator: $max",
      	"code" : 17287
      } at src/mongo/shell/query.js:131
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            siyuan.zhou@mongodb.com Siyuan Zhou
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: