bsonExtract*WithDefault inefficient in default case

XMLWordPrintableJSON

    • Fully Compatible
    • Platforms 2017-06-19, Platforms 2017-07-10
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The bsonExtract methods in bson_extract.cpp all rely on bsonExtractField() to parse the provided BSONObj. In the case where the requested field is missing, bsonExtractField() will generate an error Status object and build an error message using str::stream() both of which are expensive operations for a non-error path.

      We should optimize the "WithDefault" methods to avoid generating an error Status object in the case where the requested field does not exist.

              Assignee:
              Tyler Kaye
              Reporter:
              James Wahlin
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: