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

Change IDL serialization contract for objects

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 3.5.7
    • None
    • None
    • None
    • Fully Compatible
    • ALL
    • Platforms 2017-05-08

    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;
      

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: