The most commonly used command in Mongo...should be this:
mongo yourMongoIP:yourMongoPort
Mongo database connection instructions. My client is shell...
After connecting to the database, there are Three major commands:
show dbs //查看当前database
use yourdbname //使用yourdbname
show collections //查看当前collection
The next step is the basic operations
db.yourCollectionsName.find/delete/remove/count
Note: Delete and remove will have different restrictions depending on the version of MongoDB. However, when used, the command line will prompt whether this command is expired or not supported
Advanced ones include:
db.yourCollectionsName.aggregate/mapreduce
Note: Basically basic commands + aggregate can satisfy 90% of query commands. Because mapreduce directly executes js code, the efficiency will be much lower, so try to avoid it.
Database operation and maintenance
There are many operations involved in operation and maintenance, such as replica sets, sharding, indexes...
Recommend reading this article for replica sets and sharding: Building a Highly Available MongoDB Cluster (4) - Sharding
Index is very important, be sure to cover all queries! However, too many indexes will take up disk and insertion time. You can refer to the official documentation for use. Here is a point, When creating an index, you must remember to create it in the background, otherwise the database will be locked...
Database driver
In addition to using the command line, Mongo also provides multiple language drivers. The most troublesome C++, it took a long time to compile orz. I use pymongo for python, and I use mongodb+monk for js.
As for tools, I have never used them. The way I first learned it was that I really just read the three major commands and then used them. The rest were based on specific requirements, and I pieced together appropriate query statements from various Google and official websites. After understanding the basic operations, read the official documents again and optimize again. Well, so if possible, I still recommend that you go to the official website if you have any questions, and don't take many detours like me.
Basic operations of database
The most commonly used command in Mongo...should be this:
Mongo database connection instructions. My client is shell...
After connecting to the database, there are Three major commands:
The next step is the basic operations
Note: Delete and remove will have different restrictions depending on the version of MongoDB. However, when used, the command line will prompt whether this command is expired or not supported
Advanced ones include:
Note: Basically basic commands + aggregate can satisfy 90% of query commands. Because mapreduce directly executes js code, the efficiency will be much lower, so try to avoid it.
Database operation and maintenance
There are many operations involved in operation and maintenance, such as replica sets, sharding, indexes...
Recommend reading this article for replica sets and sharding: Building a Highly Available MongoDB Cluster (4) - Sharding
Index is very important, be sure to cover all queries! However, too many indexes will take up disk and insertion time. You can refer to the official documentation for use. Here is a point, When creating an index, you must remember to create it in the background, otherwise the database will be locked...
Database driver
In addition to using the command line, Mongo also provides multiple language drivers. The most troublesome C++, it took a long time to compile orz. I use pymongo for python, and I use mongodb+monk for js.
As for tools, I have never used them. The way I first learned it was that I really just read the three major commands and then used them. The rest were based on specific requirements, and I pieced together appropriate query statements from various Google and official websites. After understanding the basic operations, read the official documents again and optimize again. Well, so if possible, I still recommend that you go to the official website if you have any questions, and don't take many detours like me.
Hope it can be helpful to you, O(∩_∩)O~
Tutorial for newbies, first recommendation: http://www.runoob.com/mongodb/mongodb-tu...
http://www.cnblogs.com/huangxincheng/arc... Materials for novice tutorials. Getting started is fine.
nodejs tools use mongoose