简体   繁体   English

带对象的Meteor更新集合

[英]Meteor update collection with object

Is it possible to update a collection with an object? 是否可以使用对象更新集合? I've tried this below. 我在下面尝试过这个。 It'd doesn't throw an error but it doesn't update either. 它不会抛出错误但它也不会更新。 Any suggestions? 有什么建议么?

var data = {
    songTitle: 'Blah Blah',
    songTime: '1:30'
}

Songs.update({
    _id: songId,
    createdBy: currentUser,
},
{
    $set: {data}
 });

Following the referene : referene之后

you don't need to add those {} you can just : $set: data 你不需要添加那些{}你可以:$ set:data

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM