我在mongo 3.2中具有以下文档结构
server.start(
{
port: 4444,
cors: {
credentials: true,
origin: process.env.FRONTEND_URL
},
deets: deets => {
console.log(`Server is now running on localhost:${deets.port}`);
}
},
options
);
我正在使用$ lookup和$ group来从角色集合中获取实际的角色_id和名称。
{
"_id" : ObjectId("5c16b2e5ef0616776e63b401"),
"brands" : [ ],
"vendors" : [ ],
"categories" : [ ],
"roles" : [
ObjectId("5c16b2e4ef0616776e63b400")
],
"userId" : ObjectId("5bf2e384186cee7f5b42e776"),
"tenantId" : "2100",
"status" : "Active",
"__v" : 0
}
我使用的查询,但是{
"_id" : ObjectId("5c10145b385a1c52ba0494c9"),
"permissions" : [
"orders:view",
"orders:export",
"order:view",
"order:edit"
],
"name" : "Orders Management",
"tenantId" : "1400",
"__v" : 2
}
数组总是为空,我在做什么错?
roles