user4804299
user4804299

Reputation:

Exception in Mongo write when removing multiple documents

I need to remove documents which meet certain criteria...

server/methods.js

Meteor.methods({
  rA: function (a) {
        As.remove({aId:a}, {multi:true});
    }
});

As collection has documents with the same aId, it is a

client/js

var a = this.aId;
Meteor.call('rA', a);

I got following error on my terminal:

I20151231-06:39:24.849(7)? Exception in Mongo write: TypeError: object is not a function
I20151231-06:39:24.850(7)?     at packages/mongo/mongo_driver.js:322:1
I20151231-06:39:24.851(7)?     at runWithEnvironment (packages/meteor/dynamics_nodejs.js:110:1)

How do I remove multiple documents?

Thank you and happy new year... ^_^

Upvotes: 0

Views: 120

Answers (1)

Thai Tran
Thai Tran

Reputation: 9925

There is no {multi:true} for the removing method. It should be

As.remove({aId:a});

multi is only for update. Check out the documentation in here

Upvotes: 1

Related Questions