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

Popular posts from this blog

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -