[SERVER-29081] Add toBSON to IDL generated classes. Created: 04/May/17  Updated: 30/Oct/23  Resolved: 12/May/17

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

Type: New Feature 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
Sprint: Platforms 2017-05-29
Participants:

 Description   

In testing a lot of IDL generated classes, a common pattern is the following:

    BSONObjBuilder builder;
    obj.serialize(&builder)
    auto doc = builder.obj();

In order to reduce the amount of copy/pasted code, the following method will be added to IDL generated classes for testing IDL classes.

BSONObj toBSON() {
    BSONObjBuilder builder;
    obj.serialize(&builder)
    return builder.obj();
}



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

Author:

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

Message: SERVER-29081 Add toBSON to IDL generated classes
Branch: master
https://github.com/mongodb/mongo/commit/107b0bdf954bed554cf74a69a3fec268ac00886b

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