[SERVER-72102] Calculate BSON size of a document without serialization Created: 14/Dec/22 Updated: 28/Feb/23 Resolved: 28/Feb/23 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Romans Kasperovics | Assignee: | Romans Kasperovics |
| Resolution: | Won't Do | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Participants: | |||||||||
| Description |
|
With serialization it can be done by calling doc.toBson().objsize(). However, serialization is somehwhat slow (ca. 1ms for a 16MB document), as it requires memory allocation. |