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

MongoServerError: batched writes must generate a single applyOps entry

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.3.0-rc0, 7.0.6
    • Affects Version/s: 7.0.2
    • Component/s: None
    • Labels:
      None
    • Storage Execution
    • Fully Compatible
    • ALL
    • v7.2, v7.1, v7.0
    • Hide
      1. create a larger collection "collection1" in database1, preferably with size > 100 MB.
      2. issue command in the shell to move that collection to database2:
        ```
        db.runCommand( {             renameCollection: `database1.collection1`,             to: `database2.collection1`,         }

        );
        ```

      3. See the error
      Show
      create a larger collection "collection1" in database1, preferably with size > 100 MB. issue command in the shell to move that collection to database2: ``` db.runCommand( {             renameCollection: `database1.collection1`,             to: `database2.collection1`,         } ); ``` See the error
    • Execution Team 2024-01-08, Execution Team 2024-01-22

      Since MongoDB 7 (and perhaps even since 6) there's an issue that prevents moving large collections between databases by using

      db.runCommand({renameCollection:'database1.a', to:'database2.a'})

      It fails with an error message:
      ```

      MongoServerError: batched writes must generate a single applyOps entry

      ```

      Reading the logs refers that it tries to do it as a transaction and there's that infamous 16 MB limit or something that is met in case a  larger collection is being moved.

            Assignee:
            matt.kneiser@mongodb.com Matt Kneiser
            Reporter:
            sven.varkel+mongodb@gmail.com Sven Varkel
            Votes:
            0 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: