// import data only when Products collection is empty
if (Products.find().count() === 0) {
console.log("Importing private/products.json to db")
var data = JSON.parse(Assets.getText("products.json"));
data.forEach(function (item, index, array) {
Products.insert(item);
})
}
Credits:
https://stackoverflow.com/questions/25370332/import-json-file-into-collection-in-server-code-on-startup