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

Distinct command should accept a BSON element of type null for the "query" field

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.1.8
    • Affects Version/s: 3.1.7
    • Component/s: Querying
    • Fully Compatible
    • ALL
    • Hide

      with 3.1.6, start a shell:

      > db.runCommand({distinct: "bar", key: "x", query: null})
      {
              "waitedMS" : NumberLong(0),
              "values" : [ ],
              "stats" : {
                      "n" : 0,
                      "nscanned" : 0,
                      "nscannedObjects" : 0
              },
              "ok" : 1
      }
      

      with 3.1.7, start a shell:

      > db.runCommand({distinct: "bar", key: "x", query: null})
      {
              "waitedMS" : NumberLong(0),
              "ok" : 0,
              "errmsg" : "\"query\" had the wrong type. Expected Object, found NULL",
              "code" : 14
      }
      
      Show
      with 3.1.6, start a shell: > db.runCommand({distinct: "bar" , key: "x" , query: null }) { "waitedMS" : NumberLong(0), "values" : [ ], "stats" : { "n" : 0, "nscanned" : 0, "nscannedObjects" : 0 }, "ok" : 1 } with 3.1.7, start a shell: > db.runCommand({distinct: "bar" , key: "x" , query: null }) { "waitedMS" : NumberLong(0), "ok" : 0, "errmsg" : "\" query\ " had the wrong type. Expected Object , found NULL" , "code" : 14 }
    • Quint 9 09/18/15

      The distinct command used to accept a null query parameter (up through 3.1.6), but the latest nightly (3.1.7) raises an error.

      This will be a backwards breaking change for any user/driver that was sending a null query.

            Assignee:
            yunhe.wang YunHe Wang
            Reporter:
            craig.wilson@mongodb.com Craig Wilson
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: