How can I update or insert bulk operations in Meteor Mongodb?
Here is my simple script:
var obj = [];
for(var i = 0; i < 100000; i++){
obj.push({title: i, inTime: new Date(), outTime: new Date})
}
Activities.bulkWrite([
{
insertMany: obj
}
])
Why I am getting this error:
Exception while invoking method TypeError: Activities.bulkWrite is not a function
Meteor Collection object doesn't have the bulkWrite function. Remember, Meteor uses a lib to provide MongoDB function. To access the native functions of MongoDB in a collection, you need to use rawCollection
. See here.