我在mongo中有一个包含文档的收藏集。
{
_id: "1",
name: "test1",
active: true,
cars: [
{ _id: "2", name: "aaa", active: true },
{ _id: "4", name: "ccc", active: true },
}
我只想退还有效物品。在此示例中:
size = 100
time = np.zeros(size)
amplitude = np.zeros(size)
frequency = np.zeros(size)
我该怎么做?
答案 0 :(得分:0)
您需要使用聚合管道来new Vue({
router,
store,
render: h => h(App)
}).$mount('#app')
停用数组元素
$filter
结果
db.col.aggregate([
{$match : {"active" : true}},
{$addFields : {
cars : {
$filter : {
input : "$cars",
as : "c",
cond : "$$c.active"}
}
}}
])