Mogodb’s simple tutorial can use common commands?

  mongodb, question

Mogodb’s learning materials are not documents or anything like that. They are a bunch of direct google, a bit deep and practical. Are there any good tools recommended, such as Rockmongo or something like that?

Basic Operation of Database

Mongo’s most commonly used command … should be this:

mongo  yourMongoIP:yourMongoPort

Mongo database connection instruction. My client is shell…… …

After connecting to the database, it isThree Commands

Show dbs // view current database
 Use yourdbname // use yourdbname
 Show collections // view current collections

The following is the basic operation

db.yourCollectionsName.find/delete/remove/count

Note: delete and remove will have different restrictions according to MongoDB’s version, but the command line will prompt if the command expires or is not supported.

The advanced ones are:

db.yourCollectionsName.aggregate/mapreduce

Note: Basically, the basic command +aggregate can satisfy 90% of the query commands. mapreduce will be much less efficient because it directly executes js code, so try to avoid it.

Operation and Maintenance of Database

There are many operations involving operation and maintenance, such as replica set, fragmentation, index, etc.

Copy set and fragment recommendation see this article:Building mongodb Cluster with High Availability (4)-Fragmentation

Index is very important, be sure to override all queries! However, too many indexes will take up disk and insertion time. For use, you can refer to official documents. Let’s mention here.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++, compiled orz for a long time. Python uses pymongo, js i use mongodb+monk.

Tools, really haven’t used. The way I learned at first was really just to read the three commands and then use them. The others met specific requirements. All kinds of google and officials pieced together the appropriate query sentences. After understanding the basic operation, read the official documents again and re-optimize. Well, so, if possible, I still suggest to find the official website if you have any questions, and don’t take many detours like me.

I hope I can help you, O(∩_∩)O~