mongodb - mogodb的简易教程,能够用到常用的命令?
ringa_lee
ringa_lee 2017-05-02 09:17:56
0
4
795

mogodb的学习资料,不是文档什么的,那些直接google一堆,有点深度和实用的,另外有好的工具推荐么,比如Rockmongo之类的

ringa_lee
ringa_lee

ringa_lee

reply all(4)
过去多啦不再A梦

Basic operations of database

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.

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template