Meteor更新对象数组

时间:2015-04-04 14:07:54

标签: meteor

我在这个Meteor项目中使用了Schema。我在Schema中有一个对象数组,我用这种方式创建它们:

'milestones.$.name'

我创建了一些像这样的属性,并允许动态插入。

现在,我想从里程碑数组中获取一个里程碑,并更新它的一些属性。 我怎么能这样做?

我现在正在尝试这个,但仍然没有积极的结果:

Projects.update(
      {_id: currentPostId, 'milestones.name':this.name}, 
      {$set: {'milestones.$': {name: this.name, hours: this.hours, complete:true}}}
    );

0 个答案:

没有答案
相关问题