A small note of mongodb operation

Installed mongodb before, this is the first time to use

 

The reason for the use is that the online business is not indexed, which causes the query to be very slow, so go to the online index

 

mongodb login command

mongo --host 10.10.18.11 -u "myUserAdmin" --authenticationDatabase "admin" -p'abc123'

Query database status

 db.stats();数据库状态

View all indexes of the database table:

 

db.getCollection('oa_article').getIndexes()

Create index:

db.getCollection('oa_article').createIndex({hash_id:1})

 

Guess you like

Origin blog.csdn.net/qq_32783703/article/details/105643344