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

bsonExtractStringField should return StatusWith<std::string> rather than using out parameters

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Icon: Major - P3 Major - P3
    • None
    • None
    • Internal Code
    • None
    • Fully Compatible

    Description

      Right now, the bsonExtractStringField function is written so that the string to be returned is provided as an 'out parameter' - a pointer to a std::string is the last argument to the function.

      The code generated for that function must assume that the pointed to string may be already populated with data, and thus must emit code to potentially clean any current state out of the string, leading to larger codegen sprinkled with calls to operator delete[].

      If the bsonExtract function instead returned a StatusWith<std::string>, the returned string would be known to be new, and simpler code could potentially be emitted.

      Overall, it would also be stylish to upgrade the remaining functions in bson_extract.h to return StatusWith<T> rather than using out parameters.

      Attachments

        Activity

          People

            backlog-server-platform DO NOT USE - Backlog - Platform Team
            andrew.morrow@mongodb.com Andrew Morrow (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: