Autoform - 更新对象数组

时间:2015-12-24 12:15:05

标签: meteor meteor-autoform meteor-collection2

我定义了这个Schema(集合:ReleaseForms):

  Diseases:{
        type: [Object], 
        optional:true
    },
    "Diseases.$.name": {
          type: String,
          optional:true
      },
    "Diseases.$.description": {
          type: String,
          optional:true
      },
    "Diseases.$.language": {
          type: String,
          optional:true
      },

以及添加了以下内容的示例:

ReleaseForms.update({
  "_id": idNewReleaseForm},
  {
    $push:{
      Diseases:{
        name:"Blutverdünnungstherapie",
        description:"xxxxxxxxxxxx",
        language: "de"
      }
    },
  });

如果我通过Autoform查看并说更新,它不会显示现有的对象,如(Blutverdünnungstherapie): 但“名称”显示名称的现有条目!

{{#autoForm collection="ReleaseForms" id="afUpdateReleaseForm" type="update" doc=selectedReleaseFormDoc}}
    <fieldset>
{{> afQuickField name="Name"}}
    {{> afArrayField name="Diseases"}}
    </fieldset>
        <button type="submit" class="btn btn-primary">Update</button>
    {{/autoForm}}

我能看到疾病的现有条目,并允许我编辑它们,我能做什么?

0 个答案:

没有答案