-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Fully Compatible
-
ALL
-
Platforms 2017-05-08
Currently, the IDL serialization contract for objects, and any types assume they implicitly know the field name they want to serialize as. While may often be true, this contract does not support all scenarios.
Old Contract
void serialize(BSONObjBuilder* builder) const
New Object Contract
const BSONObj serialize() const
Any is more difficult and depends on whether it is serialized as a field or a member of an array.
New Any Contract
/** * Serialize this class as a field in a document. */ void serialize(StringData fieldName, BSONObjBuilder* builder); /** * Serialize this class as an element of a BSON array. */ void serialize(BSONArrayBuilder* builder) const;