MONGODB BASIC OPERATIONS
MONGODB BASIC OPERATIONS
Date posted :11/05/2019
INTRODUCTION:
In this tutorial we are going to see about mongodb basic operations.
1)Start mongodb in port
The following command used to start the mongodb with the port(27017).
monogod --port 27017
2)Stop mongodb
To stop the mongo services the following command used to stop the mongo services.
ps -ef | grep mongo
The following command is used to kill the mongodb services using the processid.
kill <PID>
3)Stop mongodb with path
ps -ef | grep mongo
MONGODB WITH HOMEBREW
1)Configure mongodb
Data directory should be created to allow MongoDB to write its data files to it.
sudo mkdir -p /data/db
sudo chown $USER /data/db
2)Start mongodb
The following command used to start the mongodb.
mongod
The following command used to start the mongodb with the path.
mongod --dbpath "/new/db/path"
3)Star and stop mongodb service
List
The following command used to list which are all the services run on the mongodb.
brew services list | grep mongodb
Start
The following code is used to start the mongo services with the brew command.
brew services start mongodb
Stop
The following code is used to stop the mongo services with the brew command.
brew services start mongodb
Thanks for using pheonixsolution.
You find this tutorial helpful? Share with your friends to keep it alive.