Details
-
Bug
-
Resolution: Works as Designed
-
Major - P3
-
None
-
None
-
None
-
ALL
Description
In the mongo shell (connecting to a 3.6 or a 4.0 mongod), update, delete and find queries don't seem to support the $code type. Insert operations however do allow $code, and all operations do support Code (instead of $code).
Example:
Insert works with Code and $code
vladmac(mongod-3.6.4) test> db.foo.insert({"_id":Code("whatever")})
|
Inserted 1 record(s) in 50ms
|
WriteResult({
|
"nInserted": 1
|
})
|
Delete, update and find work with Code but do not work with $code
vladmac(mongod-3.6.4) test> db.foo.deleteOne({"_id":{"$code": "whatever"}})
|
2018-08-29T15:40:53.500-0400 E QUERY [thread1] WriteError: unknown operator: $code :
|
WriteError({
|
"index": 0,
|
"code": 2,
|
"errmsg": "unknown operator: $code",
|
"op": {
|
"q": {
|
"_id": {
|
"$code": "whatever"
|
}
|
},
|
"limit": 1
|
}
|
})
|
WriteError@src/mongo/shell/bulk_api.js:466:48
|
Bulk/mergeBatchResults@src/mongo/shell/bulk_api.js:846:49
|
Bulk/executeBatch@src/mongo/shell/bulk_api.js:910:13
|
Bulk/this.execute@src/mongo/shell/bulk_api.js:1154:21
|
DBCollection.prototype.deleteOne@src/mongo/shell/crud_api.js:363:17
|
@(shell):1:1
|