javascript - Nodejs exec mongodb command in Bluebird Promise -
i want run mongod command in node.js using promises, database operations can run after mongodb process started. tried hands following, failed:
var promise = require("bluebird"); var execasync = promise.promisify(require('child_process').exec); execasync("~/mongodb/bin/mongod").then(function(result){ console.log("started mongodb..."); }).catch(function(error){ console.log("error in starting mongodb..."+json.stringify(error)); });
any suggestions?
you shouldn't start mongod process in node, should doing other way. can check whether it's running, not whether has started properly.
Comments
Post a Comment