Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-29081

Add toBSON to IDL generated classes.

    • Type: Icon: New Feature New Feature
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.5.7
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • Platforms 2017-05-29

      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();
      }
      

            Assignee:
            mark.benvenuto@mongodb.com Mark Benvenuto
            Reporter:
            mark.benvenuto@mongodb.com Mark Benvenuto
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: