I am facing an issue in my meteor.js app, specifically with mongo. Whenever I attempt to execute an update query in my Meteor.JS application, it fails and throws the following error:
Exception while invoking method 'deleteNotifications' MongoError: '$set' is empty. You must specify a field like so: {$mod: {<field>: ...}}
The error message is insisting that I must use the $set mongo mod, but the problem is that I do not want to use it. Below is my query (written in coffeescript):
Messages.update
_id:
$in: messagesIds
,
$push:
readByReceivers: Meteor.userId()
,
multi: true
All the required values are present, and interestingly, if I replace $push with $set in the query, it works.
Strangely, when I try the same query directly in mongodb for the meteor app, it works flawlessly:
db.messages.update({_id: {$in: ["x6PpcE829GsWarjB5"]}},{$push: {readByReceivers: "nx7XkXsmeMh6pz5n3"}},{multiple: true})
Why does meteor insist on me using $set?