[SERVER-44531] A BSON smaller than 16 bytes smaller than 16 MB gets rejected by the server for being too big. Created: 09/Nov/19  Updated: 20/Dec/19  Resolved: 20/Dec/19

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 4.0.3
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Bh Sr Assignee: Carl Champain (Inactive)
Resolution: Incomplete Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Steps To Reproduce:

1) Create a document of size 16,777,200.

2) Insert it to a collection via bulk write.

 

Here's some sample code.

auto write =collection.create_bulk_write(mongocxx::options::bulk_write{}.ordered(false));
 write.append(mongocxx::model::insert_one(doc));
 std::size_t len = doc.length(); // returns 16777200
 write.execute(); 

 

I get an exception whose

domain = 17

code = 2

message = "object to insert too large. size in bytes: 16777217, max size: 16777216"

Participants:

 Description   

I insert a single document of size 16,777,200 bytes via mongocxx's bulk write. But the server (running v4.0.3) returns an error which says "object to insert too large. size in bytes: 16777217, max size: 16777216". It looks like the server thinks that the object 17 bytes bigger than what I sent. Why could this be happening? How can I avoid this error while using bulk write via mongocxx?



 Comments   
Comment by Carl Champain (Inactive) [ 20/Dec/19 ]

Hi bhargavabhat@gmail.com,

We haven’t heard back from you for some time, so I’m going to mark this ticket as resolved. If this is still an issue for you, please provide additional information and we will reopen the ticket.

Thank you,
Carl

Comment by Carl Champain (Inactive) [ 04/Dec/19 ]

Hi bhargavabhat@gmail.com,

Any updates on this issue?

Comment by Carl Champain (Inactive) [ 12/Nov/19 ]

Hi bhargavabhat@gmail.com,

Thanks for the report.
One possible reason the size of the document is changing could be the addition of the _id field. Can you please provide the document to either confirm that suspicion or provide additional context?

Kind regards,
Carl

Generated at Thu Feb 08 05:06:14 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.