码迷,mamicode.com
首页 > 其他好文 > 详细

$filter

时间:2016-09-13 11:52:47      阅读:192      评论:0      收藏:0      [点我收藏+]

标签:

db.inventory.aggregate(
[
{
$unwind: "$sizes"
}
,
{
$group:{"}
}
] )


sudo iptables -L -n
service iptables status
service iptables start

$project: {
items: {
$filter: {
input: "$items",
as: "item",
cond: { $gte: [ "$$item.price", 100 ] }
}
}
}

msg: {$filter: {input: "$msg", as: "msg", cond: {$eq: ["$$msg.name", "name1"]}}}
$filter: { input: [ 1, "a", 2, null, 3.1, NumberLong(4), "5" ], as: "num", cond: { $and: [ { $gte: [ "$$num", NumberLong("-9223372036854775807") ] }, { $lte: [ "$$num", NumberLong("9223372036854775807") ] } ] } }

db.collectionname.aggregate({$match: {"msg.name": "name1"}}, {$project: {_id: 0, timestamp: "$timestamp", msg: {$filter: {input: "$msg", as: "msg", cond: {$eq: ["$$msg.name", "name1"]}}}}})

$filter

标签:

原文地址:http://www.cnblogs.com/jayruan/p/5867711.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!