我正在运行聚合查询
db.collection.aggregate([
{"$unwind":"$blocks"},
{"$unwind":"$blocks.ports"},
{"$match":{"blocks.ports.portType.function":"input"}},
{$project:{_id:0, port:"$blocks.ports"}}
])
在此文档上
{ "blocks" : { "ports" : {"portType" : { "function" : "input"} } } }
我以嵌套结构的格式获取结果
{"ports":{<first-key>: <first-value>, ...}},{"ports":{<first-key>: <first-value>, ...}},...
是否可以忽略此嵌套结构并直接获取包含所有字段的端口列表?
{<first-key>: <first-value>, ...},{<first-key>: <first-value>, ...}