MongoDB Operation rules
Download the installation files from the Web site
Then create the folder in the installation directory data and log
Creating a configuration file Mongo.config
The inside padding is as follows:
# #数据文件
Dbpath=d:\mongodb\data
# #日志文件
Logpath=d:\mongodb\log\mongo.log
# #错误日志采用追加模式, after configuring this option, the MongoDB log is appended to the existing log file instead of creating a new file
Start MongoDB
Start the following command under the cmd command
D:
CD D:\MongoDB
CD bin
Then enter Mongod--config d:mongodb\mongo.config
Do not close this window
Then click on file Mongo.exe in the bin directory to
Create several libraries
>use database name
Then appear
switched to DB database name
>db
Database name
View all databases
>show DBS is available.
But the database you just created is not shown here because there is no data
We want to see, of course, inserting data
>db.myblog.insert ({' Bid ': 1, ' bname ': ' Alan '})
Then appear
Writeresult ({"ninserted": 1})
View Database
>show DBS
Blog
At this point we can view the created table
>show Collections
MyBlog
You can also create tables like this
>db.createcollection ("MyTest") enter
{"OK": 1}
Continue to view
> Show Collections
MyBlog
MyTest
Querying data
>db.myblog.find () Enter to see the data you just inserted
{"_id": Objiectid ("57414249dd1a4ffc85e11928"), "bid": 1, "bname": "Alan"}
MongoDB Database Practice Notes