Details
-
Bug
-
Resolution: Duplicate
-
Major - P3
-
None
-
2.2.6, 2.5.3
-
ALL
-
Description
Hi,
It looks like there was a behavior change between 2.0 and 2.2 that results in an error 13431 if you attempt to sort by a key that has been explicitly excluded in a projection when running a query via a mongos.
I was just wondering if this is expected behavior.
mongos> db.version()
|
2.0.9
|
mongos> db.foo.save({id:3, value:'c'})
|
mongos> db.foo.save({id:2, value:'b'})
|
mongos> db.foo.save({id:1, value:'a'})
|
mongos> db.foo.find({},{id:0}).sort({id:1})
|
{ "_id" : ObjectId("523bd35dff9a7c468936efba"), "value" : "a" }
|
{ "_id" : ObjectId("523bd358ff9a7c468936efb9"), "value" : "b" }
|
{ "_id" : ObjectId("523bd352ff9a7c468936efb8"), "value" : "c" }
|
mongos> db.version()
|
2.2.6
|
mongos> db.foo.find({},{id:0}).sort({id:1})
|
error: {
|
"$err" : "have to have sort key in projection and removing it",
|
"code" : 13431
|
}
|
Attachments
Issue Links
- is related to
-
SERVER-11877 mongos query results include sort fields implicitly excluded by projection
-
- Closed
-
-
DOCS-1978 Add sharding restriction: sort fields must be in the projection
-
- Closed
-
- related to
-
SERVER-19355 Support skip, limit, and projection in new find/getMore commands path on mongos
-
- Closed
-