标签:mon des collect mongo etc code aggregate 数组元素 sort
db.getCollection(‘test‘).aggregate([ {‘$match‘: {‘codes.name‘: ‘a‘}}, // 检索文档 {$unwind: "$codes"}, // 拆分数组 {‘$match‘: {‘codes.name‘: ‘a‘}}, // 检索数组元素 {‘$sort‘: {‘codes._id‘: -1}}, {‘$skip‘: 2}, {‘$limit‘: 3} ])
标签:mon des collect mongo etc code aggregate 数组元素 sort
原文地址:http://www.cnblogs.com/daas/p/7112234.html