0
我的meteor.js應用程序中有問題,mongo更加精確。當我試圖讓我的Meteor.JS應用此更新查詢它不工作,它拋出這個錯誤:MongoDB查詢不適用於Meteor.js
Exception while invoking method 'deleteNotifications' MongoError: '$set' is empty. You must specify a field like so: {$mod: {<field>: ...}}
他抱怨說我沒有使用$設置蒙戈國防部,但這裏的東西,我不想使用它,你可以在下面看到我的查詢(我正在使用coffeescript)。
Messages.update
_id:
$in: messagesIds
,
$push:
readByReceivers: Meteor.userId()
,
multi: true
所有需要的值都存在,最有趣的是如果我使用$ set而不是$ push,則會處理查詢。
當我嘗試內部蒙戈流星應用程序,然後在同一查詢它的工作完美:
db.messages.update({_id: {$in: ["x6PpcE829GsWarjB5"]}},{$push: {readByReceivers: "nx7XkXsmeMh6pz5n3"}},{multiple: true})
爲什麼流星強迫我使用$設置?
您可以使用一個變量來保存Meteor.userId()函數的值嗎? – chridam
所有需要的值都存在,持有Meteor.userId()內部變量,然後使用該變量不會改變任何內容,錯誤保持不變。 – MatthewK
工作示例:我項目中的'Item.update {_id:itemId},$ push:users:user._id' – none