Add toBSON to IDL generated classes.

XMLWordPrintableJSON

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

      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
              Reporter:
              Mark Benvenuto
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: