📜  #Start & #Stop mongodb-community (1)

📅  最后修改于: 2023-12-03 14:38:43.703000             🧑  作者: Mango

Start & Stop mongodb-community

MongoDB is an open-source cross-platform document-oriented database program that uses JSON-like documents. This database system is widely used by developers for building high-performance applications across different platforms. There are times when you need to start and stop the MongoDB server manually. In this article, we will show you how to do that.

Start MongoDB Server
Windows OS
  1. Open the command prompt and navigate to the MongoDB installation directory.

  2. Navigate to the bin directory by running the command cd bin.

  3. Start the MongoDB server by running the command mongod.exe.

MacOS & Linux OS
  1. Open the terminal and navigate to the MongoDB installation directory.

  2. Navigate to the bin directory by running the command cd bin.

  3. Start the MongoDB server by running the command sudo ./mongod.

Stop MongoDB Server
Windows OS
  1. Open the command prompt.

  2. Run the command mongo.exe.

  3. Run the command use admin.

  4. Run the command db.shutdownServer().

MacOS & Linux OS
  1. Open the terminal.

  2. Run the command mongo.

  3. Run the command use admin.

  4. Run the command db.shutdownServer().

Markdown Code:

# Start & Stop mongodb-community

MongoDB is an open-source cross-platform document-oriented database program that uses JSON-like documents. This database system is widely used by developers for building high-performance applications across different platforms. There are times when you need to start and stop the MongoDB server manually. In this article, we will show you how to do that.

## Start MongoDB Server

### Windows OS

1. Open the command prompt and navigate to the MongoDB installation directory.

2. Navigate to the `bin` directory by running the command `cd bin`.

3. Start the MongoDB server by running the command `mongod.exe`.

### MacOS & Linux OS

1. Open the terminal and navigate to the MongoDB installation directory.

2. Navigate to the `bin` directory by running the command `cd bin`.

3. Start the MongoDB server by running the command `sudo ./mongod`.

## Stop MongoDB Server

### Windows OS

1. Open the command prompt.

2. Run the command `mongo.exe`.

3. Run the command `use admin`.

4. Run the command `db.shutdownServer()`.

### MacOS & Linux OS

1. Open the terminal.

2. Run the command `mongo`.

3. Run the command `use admin`.

4. Run the command `db.shutdownServer()`.

Happy MongoDB'ing!