-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: 2.6.0
-
Component/s: Querying
-
None
-
Major Change
-
ALL
-
After upgrading from 2.4 to 2.6.0 our find_and_modify commands which use sorting started failing with the above error.
PyMongo generates the following command for find_and_modify with sorting:
{ findandmodify: "test", query: { _lock: { $lte: 9999999999999 } }, update: { $set: { _lock: 1 } }, sort: [ [ "_lock", 1 ] ] }
I tested it with 2.4 and it works fine, but on 2.6.0 it fails with the error (with the latest PyMongo 2.7):
> db.runCommand({ findandmodify: "test", query: { _lock: { $lte: 9999999999999 } }, update: { }, sort: [ [ "_lock", 1 ] ] }) { "errmsg" : "exception: nextSafe(): { $err: \"Can't canonicalize query: BadValue bad sort specification\", code: 17287 }", "code" : 13106, "ok" : 0 }
Looks like MongoDB has stopped respecting "sort: [ [ "_lock", 1 ] ]" syntax.
Is this a bug or expected change? This effectively breaks PyMongo's find_and_modify with sort functionality.