[SERVER-29564] Allow BSONObjBuilder to append to existing BSONObj without copying Created: 12/Jun/17  Updated: 30/Oct/23  Resolved: 20/Jun/17

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: 3.5.9

Type: Improvement Priority: Major - P3
Reporter: Mathias Stearn Assignee: Mathias Stearn
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Repl 2017-06-19, Repl 2017-07-10
Participants:

 Description   

It should be able to reuse the SharedBuffer from an owned BSONObj as long as the ref count is 1, meaning that no other objects are using the same SharedBuffer. This addresses a common pattern in our code of needing to append a few fields to a BSONObj we just constructed.



 Comments   
Comment by Githook User [ 19/Jun/17 ]

Author:

{u'username': u'RedBeard0531', u'name': u'Mathias Stearn', u'email': u'mathias@10gen.com'}

Message: SERVER-29564 BSONObjBuilder can now be seeded with a BSONObj prefix

This will avoid copying whenever it is safe.
Branch: master
https://github.com/mongodb/mongo/commit/1babec6a705c242628a765935ac9d98b56a41218

Generated at Thu Feb 08 04:21:13 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.