-
Type: Bug
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: BSON
-
Environment:OS:
node.js / npm versions:
Additional info:
Problem Statement/Rationale
Enterprise [direct: mongos] testDB> db.testColl.insert({_id:Symbol("abc")}) { acknowledged: true, insertedIds: { '0': Symbol(abc) } } Enterprise [direct: mongos] testDB> db.testColl.find() [ { _id: ObjectId("65734ad410242d79575e87ba") } ]
The above should have either used the ID that I gave, failed the insertion if that ID is unusable, or at least warned that it’s substituting an empty ID. It shouldn’t just quietly do something radically different from what I asked.
Seen in mongosh 1.10.3.
Steps to Reproduce
Retry the above.
Expected Results
The above should have either used the _id that I gave, or failed the insertion if (as seems to be the case) that ID can’t be represented in BSON.
Actual Results
The document inserted has the ID shown above.
Additional Notes
Enterprise [direct: mongos] test> EJSON.serialize({_id:Symbol("abc")})
{}
^^ This may relate to the problem.
AC
- Add an else case to catch any type we do not explicitly support in the BSON serializer