-
Type: Bug
-
Resolution: Done
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: Usability
-
ALL
According to the documentation, only field names starting with `$` are reserved. But it seems that because of how the wire protocol is implemented (looking at what the drivers do, the documentation is a bit sparse here), certain field names take on a special meaning, such as "orderby" or "query":
> db.test.insert({_id:123, orderby: 1, query: 2}); > db.test.insert({_id:124, orderby: 2, query: 1}); > db.test.find({orderby: 1}) { "_id" : 123, "orderby" : 1, "query" : 2 } > db.test.find({query: {}, orderby: 1}) error: { "$err" : "sort must be an object or array", "code" : 13513 }
The wire protocol should be updated to use some kind of different scheme to avoid ambiguity, such as prefixing the special parts of the query with $ as happens in other places.