This Meteor code line FormDataCol.insert(temp1);
puts the document temp1
in the collection FormData
which was verified at the mongo terminal
meteor:PRIMARY> db.formData.find({}).pretty();
{
"_id" : "zTKkCrGZhBbeL2kvS",
"element" : "input",
"action" : "order",
"name" : "plate",
"placeholder" : "Enter plate code",
"valid" : "^[0-9a-zA-Z]{1,6}$",
"value" : "somevalue",
"class" : "wrongInput"
}
meteor:PRIMARY>
How can I add another document temp2
which has a different _id into the same collection with out getting the familiar key duplicate error, so I get the following output?
Both documents have been copied from other collection and more fields/values have been added to them so that “temp” is the “new” document that need to be “inserted”, how ever the _d is not important to keep the same. Thanks
meteor:PRIMARY> db.formData.find({}).pretty();
{
"_id" : "zTKkCrGZhBbeL2kvS",
"element" : "input",
"action" : "order",
"name" : "plate",
"placeholder" : "Enter plate code",
"valid" : "^[0-9a-zA-Z]{1,6}$",
"value" : "somevalue",
"class" : "wrongInput"
}
{
"_id" : "h5nxkAM5hBihS8Zeb",
"element" : "radio",
"action" : "cooke",
"name" : "x-large"
}