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

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

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Incomplete
    • Icon: Major - P3 Major - P3
    • None
    • 4.0.3
    • 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"

    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?

      Attachments

        Activity

          People

            carl.champain@mongodb.com Carl Champain (Inactive)
            bhargavabhat@gmail.com Bh Sr
            Votes:
            1 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: