mongodb - Import json file into collection in server code on startup -


i've exported mongodb collection json file on local test machine , want import through meteor.js server side code on startup (after deploying meteor.com site). i'm not finding examples of yet.

thanks

example:

    // import data when products collection empty      if (products.find().count() === 0) {         console.log("importing private/products.json db")          var data = json.parse(assets.gettext("products.json"));          data.foreach(function (item, index, array) {             products.insert(item);         })     } 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -