Hi all,
How do I create a new collection form event? For example my user story is:
-
- click on home page to veiw all current inventories (lists/collections)
-
- click on “create new inventory”
-
- new page with new form for inventory title and a few other values
-
- on submit the app creates new mongo collection using the “ListTitle” value from the submitted for as its name.
-
- app inserts new record into the collection with the input values from the form.
-
- new collectio9n appears in their dashaboard on he app so they can edit, update or remove the list.
How Do I accomplish steps 4 and 5? is it as simple as:
Template.AddNewList.events({
// when the form is submitted
’submit .new-list’(event) {
[input value from the form] = new Mongo.Collection(’[input value from the form]’);
const myData = {
key1: "listTitle.value",
}
[input value from the form] .insert(myData);
var findCollection = [input value from the form] .find().fetch();
console.log(findCollection);
}
});