Does inserting multiple documents in a Meteor Collection work the same as pure mongodb?

前端 未结 4 912
终归单人心
终归单人心 2021-02-13 04:52

It seems I can\'t do a multiple insert in Meteor the same way it is described here in the Mongodb documentation...

In my js console :

> Test.insert([{na

4条回答
  •  有刺的猬
    2021-02-13 05:23

    As of Nov 2018, you can just use rawCollection to access the collection returned by Mongo Driver and then insert an array of documents as per the Mongo documentation.

    Example:

    let History = new Mongo.Collection('History');
    
    History.rawCollection().insert([entry1, entry2, entry3]);
    

提交回复
热议问题