MongoDB insertMany() document size | How to check maxWriteBatchSize in MongoDB

insertMany() function in MongoDB accepts array of objects and can insert multiple documents in the collections. Here is the syntax for insertMany() function:-

The number of operations in each group cannot exceed the value of the maxWriteBatchSize of the database.

This can be checked by running the below query.

insertMany() document size

You also can check other configurations by running this command, for example is you database is in read only mode, if isWritablePrimary is true then instance is primary in replica set.

Share This:

Leave a Reply

Your email address will not be published. Required fields are marked *