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

Change IDL serialization contract for objects

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.5.7
    • 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;
      

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

              Created:
              Updated:
              Resolved: