mongorestore send paste commands in batch mode in the document {"applyOps", entries} . This document (AFAIK) is limited to 16 MB, like any other document.
According to sources , there are "pathological cases where the overhead of an array of many small operations can overwhelm the maximum team size." The oplogMaxCommandSize variable oplogMaxCommandSize used to help mongorestore not interrupt in such cases. It was raised to 16.5 million. At some point during the development of 3.0 .... It was too optimistic. It was reduced to 8M later ( JIRA TOOLS-754 ).
If you need, you can adjust this value yourself according to your needs. And then recompile the tools.
source share