Mongo Bulk Insert across multiple collections

给你一囗甜甜゛ 提交于 2020-01-11 04:33:10

问题


I see that mongo has bulk insert, but I see nowhere the capability to do bulk inserts across multiple collections. Since I do not see it anywhere I'm assuming its not available from Mongo. Any specific reason for that?


回答1:


You are correct in that the bulk API operates on single collections only.

There is no specific reason but the APIs in general are collection-scoped so a "cross-collection bulk insert" would be a design deviation.

You can of course set up multiple bulk API objects in a program, each on a different collection. Keep in mind that while this wouldn't be transactional (in the startTrans-commit-rollback sense), neither is bulk insert.



来源:https://stackoverflow.com/questions/30952307/mongo-bulk-insert-across-multiple-collections

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!