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 }
- is duplicated by
-
SERVER-22284 Executing a read concern query after connecting with the shell throws error
- Closed
- is related to
-
SERVER-21637 Add mixed version tests for find/getMore commands
- Closed
- related to
-
SERVER-20915 Resolve shell readMode on connection open
- Closed