A BSON smaller than 16 bytes smaller than 16 MB gets rejected by the server for being too big.

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Incomplete
    • Priority: Major - P3
    • None
    • Affects Version/s: 4.0.3
    • Component/s: None
    • None
    • ALL
    • Hide

      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"

      Show
      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"
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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?

            Assignee:
            Carl Champain (Inactive)
            Reporter:
            Bh Sr
            Votes:
            1 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: