In this five-minute tutorial, we will teach you how to quickly get started with MongoDB in a Windows environment. This article describes how to connect to the MongoDB server and how to use the MongoDB shell.
First, you need to download the 64-bit Windows 64-bit MongoDB program file, decompress the downloaded ZIP file to any location selected, decompress the file, and rename the folder to "MongoDB ".
Step 2: Open the folder of the decompressed and downloaded MongoDB program file and you will see the following executable file:
▲Mongodb executable files
Among them, two exefiles are the most important, one is mongod.exe that connects to the local data warehouse server, and the other is mongod.exe that starts MongoDB shell.
By default, MongoDB stores the new database and Data in the Data folder of drive C. The Data folder needs to be created manually by using the following methods:
▲Manually create a Data folder
You can connect to the MongoDB server by executing the mongod.exe file, as shown in:
▲Execute the mongod.exe file to connect to the MongoDB Server
After the MongoDB server is started, you can run the following mongo command to start the MongoDB shell.
▲Start MongoDB shell
To add two numbers in MongoDB shell, perform the following operations:
▲Add numbers in MongoDB shell
By default, it will connect to the database for testing:
To insert data, run the following command to create a database named "debugmode" and insert a document named dj:
You can view the help options to learn more about executable files and commands. In subsequent articles, we will further introduce how to use MongoDB and CSharp together.