【发布时间】:2018-11-09 10:21:09
【问题描述】:
我正在尝试在数组中添加一个元素,但不知道是什么导致了我的问题, 不知道我是否必须进行插入或更新,无论如何都尝试了,都不起作用
addUserToArray:function(userId,_id,email){
check(_id, String)
check(userId,String)
check(email, String)
var current_test = Modules.test.checkTestExist(test_id);
const USER = Accounts.findUserByEmail(email)
let test=USER._id
if(userId==current_test.senders[0]){
Tests.update(_id, {$set: {'name': name}}) // this one getting updated
Tests.update(test_id, { $set: { "current_test.senders": test} }) // this is not working
}
我收到了错误
UserIds that can send messages on this test must be an array",
【问题讨论】: