Currently, we serialize the ObjectId like so here:
case TypeTags::ObjectId: { buf.appendBool(true); buf.appendBytes(getObjectIdView(val), sizeof(ObjectIdType)); break; }
There is no equivalent CType when deserializing back to ObjectId and it fails here when converting to bson with "Unknown type".
When ObjectId is serialized exactly how bsonObjectId is serialized, it properly converts back into an ObjectId. ObjectId and bsonObjectId are treated as the same in some places. Additionally, when mapping to BSON types, the two both map to BSONType::jstOID.
We should serialize ObjectId using appendOID.
- is depended on by
-
SERVER-87817 The mongo instance returns an error (MongoCommandException, Location50811) in version 7.0.6, but works fine in version 6.0.12.
- Closed
-
SERVER-87818 The mongo instance crashes in version 7.0.6, but works fine in version 6.0.12
- Closed