![]() ![]() Then from the command line or within your batch script: mongo stop_mongod. Save the following snippet in stop_mongod.js file: db = connect("localhost:27017/admin") Īdjust the connection string if necessary. Instead you will need to explicitly define the database in the connection (/dbname in the example above).Īlternately, you can also create a connection within the script: db2 = connect("server:27017/otherdbname") This command does not work in scripted mode. In another terminal window, type the command /mongodb/bin/mongo in order to start the Mongo Shell. Open Command Prompt/Powershell as Administrator. Once you are assured that your MongoDb directory has all the required permissions, open the terminal application on your Mac and type the command, /mongodb/bin/mongod to start the Mongo Server. C:mongodbbin>net start MongoDBThe Mongo DB service is starting.Here is the official link about how to stop Mongodb properly : I'm automatically connected on the admin's collection and next, I just have to run the extinction. ![]() Maybe you already solved this question but here is what I do : mongo admin -eval "db.shutdownServer()" I'm not sure that's a proper way to do, sending a kill could probably cause damage to your mongo server, and you'll need to repair your database after in case of crash. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |