Mongodb Environmental Setup - MongoDB Tutorial
MongoDB Environmental Setup Procedure :
- In this article, we are going to talk about mongoDB environmental setup. It involves the following:
- Create the path for the database
- Create mongoDB service
- Start the service
- Stop the service
Step 1 :
- Check out the below path in your machine. If you don’t have the path, you have to create the folder as such to store mongoDB databases.
Step 2 :
- Goto the command prompt and type the directory path of mongoDB using “cd” command “C:\Program Files\MongoDB\Server\5.0\bin”
- Then enter data store path. Later, execute the mongod.exe waiting for the network configuration port.
cd\ cd C:\Program Files\MongoDB\Server\5.0\bin mongod.exe --dbpath C:test\mongodb\data
Step 3 : What is mongod.exe ?
- mongod.exe is the build of the MongoDB daemon (i.e. mongod) for the Windows platform.
- mongod.exe has all the features of mongod on Unix-like platforms and is completely compatible with the other builds of mongod.
- In addition, mongod.exe provides several options for interacting with the Windows platform itself.
Step 4 - Start the MongoDB service.
- If you want to Start the MongoDB service give the following command in the command prompt.
net start MongoDB
- So now the MongoDB services will start successfully.
Step 5 - Stop the MongoDB service.
- If you want to Stop the MongoDB servicegive the below command in the command terminal.
net stop MongoDB
- Or, if you want to remove the MongoDB service, use the following command as administrator.
Start/Stop MongoDB using the Windows services
- MongoDB daemon executable provides support for the installation of services using few command line parameters without using additional components.
- –install : Command line switch to install the service
- –remove : command line switch to remove the service
- –serviceName<name> : The name for mongod windows service and must be added to naming services in windows like only accepting the alphanumeric chars with no spaces
- –serviceDisplayName <display-name>: Display name for service that is shown in services console, put this in double quotes if it contains the spaces.
- –serviceDescription <description> : Small description about service, Use double quotes if it contains any spaces