[SERVER-22440] Shell incorrectly issues first query in legacy read mode Created: 02/Feb/16  Updated: 20/Nov/16  Resolved: 08/Feb/16

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: 3.2.1
Fix Version/s: 3.2.4, 3.3.2

Type: Bug Priority: Major - P3
Reporter: J Rassi Assignee: David Storch
Resolution: Done Votes: 0
Labels: code-only
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-22284 Executing a read concern query after ... Closed
Related
related to SERVER-20915 Resolve shell readMode on connection ... Closed
is related to SERVER-21637 Add mixed version tests for find/getM... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Completed:
Sprint: Query 10 (02/22/16)
Participants:

 Description   

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
}



 Comments   
Comment by Githook User [ 22/Feb/16 ]

Author:

{u'username': u'dstorch', u'name': u'David Storch', u'email': u'david.storch@10gen.com'}

Message: SERVER-22440 fix shell to resolve readMode correctly on first .find() operation

(cherry picked from commit eeac75151395b523459833aaaa34d0fe2f2f7748)
Branch: v3.2
https://github.com/mongodb/mongo/commit/148c13f77781373543063740e5ea7445c3978849

Comment by Githook User [ 08/Feb/16 ]

Author:

{u'username': u'dstorch', u'name': u'David Storch', u'email': u'david.storch@10gen.com'}

Message: SERVER-22440 fix shell to resolve readMode correctly on first .find() operation
Branch: master
https://github.com/mongodb/mongo/commit/eeac75151395b523459833aaaa34d0fe2f2f7748

Comment by David Storch [ 05/Feb/16 ]

This was introduced in 3.2.1 by SERVER-21637.

Generated at Thu Feb 08 04:00:25 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.