杂记

db.getCollection('usr').update({"_id":{$gt:1}},{"upDataTime":1515081600},{"multi":true})
db.getCollection('usr').update({"jieng.$+":{$gt:10}},{$set:{"jieng.$+":10}},{"multi":true})   ##$+ :数组中所有的元素

 

db.getCollection('ient').aggregate([
{$match :{"time":{$gt:1521129600},"rst":"成功"}},
{$group:{_id: 'max',max_value:{"$sum":"$money"}}}
]);
db.getCollection('ient').aggregate([
{$match :{"time":{$gt:1521129600},"rst":"成功"}},
{$group:{_id: 'max',max_value:{"$push":"$uid"}}}
]);
设置索引 (a,b) 查询ab或者a可以 直接查询b不行

 

 

posted on 2018-08-09 14:58  降魔  阅读(52)  评论(0编辑  收藏  举报