Bulk mongodb insert in Meteor or Node

后端 未结 3 1775
情话喂你
情话喂你 2020-12-20 03:20

MongoDB supports bulk insert http://docs.mongodb.org/manual/core/bulk-inserts/

I have tried it in Meteor collection:

Orders.insert([
    { \"cust_id\         


        
3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-20 04:09

    You could use rawCollection which is node mongodb driver implemetation in Meteor.Collection.

    await Orders.rawCollection().insertMany(arrOfOrders)

    It works on 70M data in my case. (await makes it synced so you should consider to use it or not for your purpose.)

提交回复
热议问题