MongoDB Installation
MongoDB with cross-platform excellent features, providing support for the mainstream operating system, we can choose to download the corresponding installation package according to the operating system we use.
Figure 1.MongoDB support for each version of the operating system
MongoDB The installation on each operating system is simple, we only need to download the installation package, extract to a directory, and then specify the storage directory and execute Mongod , it can listen to the client's link request, the following is a brief introduction to the Ubuntu under the installation process:
Copy the downloaded installation package to a specific directory and unzip it
figure 2. copy MongoDB and unzip
Perform decompression MongoDB under the directory Bin/mongod , and through DBPath parameter specifies the data storage directory.
Figure 3. start the MongoDB server Side
figure 4. start MongoDB error, modify data directory permissions
Figure 4 we can see the MongoDB error when starting, modify the owner of the directory, and then restart MongoDB , start successfully < Span lang= "en-US" > 5 " shown.
Figure 5.MongoDB Startup Success
above the way to startMongoDBmode, you need to always open the command line terminal, if you accidentally close it,MongoDBthe process is closed. MongoDBprovides a backgroundDaemonway to start the way we just need to add parameters-Forkand the--logpathcan be.
MongoDB in the Shell
MongoDBcomes with aJavascriptshell, so that we can from the command line withMongoDBto interact. Through thisShellwe can perform administrative operations,
Check running instances, perform regular database operations, and so on.
through ctrl+alt+t Open terminal, then enter MongoDB , execution bin/ MONGO start Shell .
Figure 6. start the shell
Shell The database server is automatically linked at startup, so you need to make sure that the server is started.
Shell is a fully functional JavaScript interpreter, which can perform any of the JavaScript program.
Figure 7. executing javascript in the shell