node.js - How to start Mongodb in node code?
女神的闺蜜爱上我
女神的闺蜜爱上我 2017-06-10 09:48:07
0
3
791

Everything I found on the Internet was how to connect Mongodb, but I didn’t see how to start it.

Does everyone manually start Mondodb when developing locally, and then open a command line to perform other operations?

For example, is there any method or plug-in that can directly specify the port to start Mongodb in app.js? I have just started to contact these, and I hope you can give me some advice.

女神的闺蜜爱上我
女神的闺蜜爱上我

reply all(3)
typecho

... you mongo. . Why use node to start. . You need to use mongodb to manually start the mongo service. . . The node program is only responsible for connecting to mongo

巴扎黑

In the scripts section of package.json, add the relevant scripts:

https://docs.npmjs.com/misc/s...

You can take a look at prestart/poststop.

Love MongoDB! Have fun!

某草草

The questioner probably wants to start mongo directly in the code, using npm scripts in
package.json

{
"start:mongo":"Start mongo's bash"
}

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template