我有一个查询来查询我期望的所有url_permissions
。
但是这里有一个问题。我有url_permissions
,但它们仍在我的结果数组中。
我如何将它们全部作为一个ObjectId而不是一个数组?
{
"_id" : ObjectId(""),
"role" : "",
"sub_permissions" : [ObjectId(''), ObjectId(''), ObjectId(''), ....],
"url_permissions" : [ObjectId(''), ObjectId(''), ObjectId(''), ....]
}
db.permissions.aggregate(
[
{ $match: { _id: { $in: ARRAY_HERE_NOT_IMPORTANT } } },
{ $group :
{
_id : null,
url_permissions: { $push: '$url_permissions' }
}
}
]
)
{
"_id" : null,
"url_permissions" : [
[
ObjectId("5c6ad3191da7a5ff43d13c7f"),
ObjectId("5c6ad3341da7a5ff43d13c95")
],
[
ObjectId("aaaad3d51da7a5ff43d1dddd")
]
]
}
{
"_id" : null,
"url_permissions" : [
ObjectId("5c6ad3191da7a5ff43d13c7f"),
ObjectId("5c6ad3341da7a5ff43d13c95"),
ObjectId("aaaad3d51da7a5ff43d1dddd")
]
}