【发布时间】:2019-09-27 05:04:06
【问题描述】:
我必须从 MongoDB 中的多个集合中执行查找,即我的查询如下所示 -
{
_id:1003, // This belongs to user collection
'user.firstName':'xyz', // This belongs to user collection
'user.lastName':'xyz', // This belongs to user collection
'member._id':1004,// This belongs to user's family member collection
'member.firstName':'xyz', // This belongs to member collection
'member.lastName':'xyz', // This belongs to member collection
}
现在我想支持使用多个参数进行搜索,即用户可以通过user name or member name 或user name and member name 或user id or member id 或user id and member id 或all of the params 进行搜索
我的问题是如何使用多个参数从多个集合中执行搜索。任何帮助或指针将不胜感激。
【问题讨论】:
标签: mongodb mongodb-query aggregation-framework