Telescope Nova Insert dynamic add (date, string) array into mongoDb while new post

54 views Asked by At

enter image description here

As shown in image above i want dynamic (name,amount) field in telescope nova while user posting NEW POST.

Below is my 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
      }
    }
  });

And below is my 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>)
}

I am not adding adding and deleting of array..bocz i dont want to make it complicated

0

There are 0 answers