标签:base val mongod linu tar mon pre nbsp tps
https://www.mongodb.com/download-center/community
比如:
https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-4.0.9.tgz
# cd $MONGODB_HOME
# bin/mongo master:27017/database_name
1 count
>db.getCollection(‘table_name‘).find({}).count()
2 group by
>db.getCollection(‘table_name‘).aggregate([{"$group": {_id: "$column_name", count: {"$sum": 1}}}])
3 select by limit
>db.getCollection(‘table_name‘).find({}).limit(1).pretty()
4 select by condition ‘=’
>db.getCollection(‘table_name‘).find({"column_name": "column_value"})
5 select by condition ‘>’
>db.getCollection(‘table_name‘).find({"column_name":{$gt:"column_value"}}).pretty()
6 select by condition ‘or’
>db.getCollection(‘table_name‘).find({$or: [ {"column_name1":"column_value1"},{"column_name2":{$gt:"column_value2"}}]}).pretty()
标签:base val mongod linu tar mon pre nbsp tps
原文地址:https://www.cnblogs.com/barneywill/p/10874146.html