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.

admin

Our team has expertise across software and web development, WordPress, e-commerce, mobile applications, UI/UX, cloud and infrastructure, DevOps, CI/CD, API integration, security, testing, automation, and technical support. The team also works with AI-based software solutions, LLMs, AI workflows, AI agents, and intelligent application development to help businesses automate processes and build smarter digital solutions. We focus on developing, deploying, maintaining, and optimising secure, scalable, and reliable technology solutions while helping businesses adopt modern technologies and drive digital transformation.

Leave a Comment

Scroll to Top