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

Change IDL serialization contract for objects

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.5.7
    • Component/s: None
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Epic Link:
    • Sprint:
      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

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: