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

Shell incorrectly issues first query in legacy read mode

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.2.4, 3.3.2
    • Affects Version/s: 3.2.1
    • Component/s: Shell
    • Fully Compatible
    • ALL
    • Query 10 (02/22/16)

      In a shell session with a server that supports read commands, the first query issued is executed with legacy OP_QUERY reads, but subsequent queries are executed with read commands. If the server supports read commands, all queries should be executed with read commands.

      See the following shell session:

      MongoDB shell version: 3.2.1
      connecting to: test
      > db.version()
      3.2.1
      > db.foo.find().sort([{a: 1}, {b: 1}])  // Executes with OP_QUERY legacy reads.
      { "_id" : ObjectId("56b0fbb44739a301b71f0e73") }
      { "_id" : ObjectId("56b0fd134739a301b71f0e78"), "a" : -1, "b" : 3 }
      { "_id" : ObjectId("56b0fd164739a301b71f0e79"), "a" : -1, "b" : 7 }
      { "_id" : ObjectId("56b0fd0c4739a301b71f0e74"), "a" : 1, "b" : 1 }
      { "_id" : ObjectId("56b0fd0f4739a301b71f0e76"), "a" : 1, "b" : 3 }
      { "_id" : ObjectId("56b0fd0e4739a301b71f0e75"), "a" : 1, "b" : 5 }
      { "_id" : ObjectId("56b0fd114739a301b71f0e77"), "a" : 2, "b" : 3 }
      > db.foo.find().sort([{a: 1}, {b: 1}])  // Executes with read commands.
      Error: error: {
      	"waitedMS" : NumberLong(0),
      	"ok" : 0,
      	"errmsg" : "Failed to parse: sort: [ { a: 1.0 }, { b: 1.0 } ]. 'sort' field must be of BSON type Object.",
      	"code" : 9
      }
      

            Assignee:
            david.storch@mongodb.com David Storch
            Reporter:
            rassi J Rassi
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: