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.
... 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"
}