Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我目前在生产环境中使用 MongoDB V3.4,并且必须从另一个 MongoDB 相同版本批量插入数据。我目前正在通过使用一个跟踪主数据库的操作日志并将这些操作复制到我的目标数据库中的工具来实现这一点。但是,有时会出现错误,例如“写入批量大小必须在 1 到 1000 之间。得到 2000”并且进程停止。我做了一些挖掘,发现 MongoDB v<3.5 中的 maxWriteBatchSize 限制为 1000。我可以绕过或更改此限制吗?
该限制在https://github.com/mongodb/mongo/blob/r3.4.24/src/mongo/s/write_ops/batched_command_request.cpp#L43硬编码
const size_t BatchedCommandRequest::kMaxWriteBatchSize = 1000;
为了改变它,你必须重新编译。