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

BSONObjBuilder and BSONArrayBuilder objects should be re-useable

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 1.6.3, 1.6.4, 1.6.5, 1.7.0, 1.7.1, 1.7.2, 1.7.3
    • Component/s: Internal Client
    • Labels:
      None
    • Fully Compatible

      While using BufBuilder, BSONObjBuilder, and BSONArrayBuilder to generate BSON in C++, it would be nice to be able to associate a pool of BSONObjBuilder and BSONArrayBuilder objects with a BufBuilder so these objects can be efficiently obtained and re-used. This is currently not possible, since there is no way to inform a BSONObjBuilder that its _offset field should be reset to the current 'len' of its underlying BufBuilder, so these objects are one and done.

      BSONObjBuilder and BSONArrayBuilder should offer a method that resynchronizes the builder with the current position in the underlying BufBuilder. I haven't been able to come up with a particularly good name for this method, so I'm open to suggestions, but something like 'resynchronizeWithBufBuilder' might do. Given that this is a sort of special case method, it is probably OK for it to have a sort of ugly name.

            Assignee:
            mathias@mongodb.com Mathias Stearn
            Reporter:
            andrew.morrow@mongodb.com Andrew Morrow (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: