Hey guys,
Having this small issue where a method I’m calling is throwing an exception in the console. The method actually works but how can I address fixing the exception?
Function :
deleteAllNotifications(v) {
if (this.props.notifications.length > 0) {
Meteor.call('delete.all.notifications', v, (error) => {
});
}
}
Method :
'delete.all.notifications': function(v) {
if (v === Meteor.userId()) {
NotificationsCollection.remove({uid: Meteor.userId()}, { multi: true });
} else {
throw new Meteor.Error("Operation failed!");
}
}
As mentioned, the function & method actually work but I’m seeing this in the server console :
Exception in callback of async function: TypeError: callback is not a function
at packages/mongo/collection.js:729:7
at runWithEnvironment (packages/meteor.js:1356:24)
at packages/meteor.js:1369:14
at packages/mongo/mongo_driver.js:323:7
at runWithEnvironment (packages/meteor.js:1356:24)
Did a bit of searching and the only thing I could find was that this error gets thrown when you try to use insert with multi: true. Is this also the case with remove and if so how can I fix it?