Telescope Nova在新帖子中插入动态添加(日期,字符串)数组到mongoDb中

时间:2016-12-14 18:25:14

标签: mongodb reactjs meteor telescope

enter image description here

如上图所示,我想在用户发布新帖子时在望远镜新星中使用动态(名称,数量)字段。

以下是我的custome-package custom_field.js

var NameAmount = new Mongo.Collection("NameAmount");
 NameAmount .schema = new SimpleSchema({ 
 country:{
     type:String
 },
 RelDate:{
     type:Date
 }
});
NameAmount.attachSchema(NameAmount .schema);
Posts.addField({
    fieldName: "Name_Amount",
    fieldSchema: {
      type: [NameAmount],
      optional: true,
      control:NameAmountForm, 
      insertableIf: canInsert,
      editableIf: canEdit,
      join: {
        joinAs: "Name_Amount",
        collection: () => Name_Amount
      }
    }
  });

以下是我的Meteor React NameAmountForm

render(){
         const nameAmt =new Array(2);
return(<div>
{newAmt.map(function(items){
return(<div>
 Name  <input type="text" name="Name" value="xyz"/>
 Amount <input type="text" name="Amount" value="xyz"/>
</div>)

})}

</div>)
}

我没有添加添加和删除array..bocz我不想让它变得复杂

0 个答案:

没有答案