我的数据库包含collection
以下形式的用户:
{
"userId": "12345",
"vertical": "BFS",
"Role": "Manager"
},
{
"userId": "12345",
"vertical": "Insurance",
"Role": "Manager"
},
{
"userId": "12367",
"vertical": "BFS",
"Role": "Associate"
}
我知道vertical
,manager
并且我必须从中找到userId
. 然后我必须找到verticals
特定用户的。
就像在 SQL 中一样:
select vertical
from user
where role="Manager"
and userid in (
select userid from user
where vertical="BFS" and role="Manager"
)
请帮助解决这个问题。我是这项技术的新手。