[SERVER-28985] Change IDL serialization contract for objects Created: 26/Apr/17  Updated: 30/Oct/23  Resolved: 01/May/17

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 3.5.7

Type: Bug Priority: Major - P3
Reporter: Mark Benvenuto Assignee: Mark Benvenuto
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Platforms 2017-05-08
Participants:

 Description   

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;



 Comments   
Comment by Githook User [ 01/May/17 ]

Author:

{u'username': u'markbenvenuto', u'name': u'Mark Benvenuto', u'email': u'mark.benvenuto@mongodb.com'}

Message: SERVER-28985 Change IDL serialization contract for objects
Branch: master
https://github.com/mongodb/mongo/commit/db53b03f5c1420b9bcade637873522f1847f9e3f

Generated at Thu Feb 08 04:19:36 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.