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

BSON headers provide no way to give the length of a c string when used as a key or value

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • 1.5.3
    • Internal Client
    • None
    • All
    • Fully Compatible

    Description

      Consider the following code:

      const char kKey[] = "key";
      const char kValue[] = "value";
      someBSONObjBuilder.append(key, value);

      This is going to cause two calls to strlen which certainly don't need to be made, since the lengths of kKey and kValue are known at compile time. For such cases, it would be nice to have a mechanism to pass the already known size down to the BSONObjBuilder:

      someBSONObjBuilder.append(key, sizeof(key), value, sizeof(value));

      Similar overloads would need to be made for each type'd BSONObjBuilder::append(key, sizeof(key), T), and for BSONArrayBuilder.

      Attachments

        Activity

          People

            andrew.morrow@mongodb.com Andrew Morrow (Inactive)
            andrew.morrow@mongodb.com Andrew Morrow (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: