Hi,
I’ve two collection, “users” and “orders”.
users:
[
{
"_id": "6702467ffc13ae106c4fe5e4",
"firstName": "Laughton",
"lastName": "Humpatch"
},
{
"_id": "6702467ffc13ae106c4fe5e5",
"firstName": "Maurizio",
"lastName": "Geertje"
},
{
"_id": "6702467ffc13ae106c4fe5e6",
"firstName": "Doralia",
"lastName": "Hunnisett"
}
]
orders
[
{
"_id": "6702467ffc13ae106c4fe5e7",
"__user": "6702467ffc13ae106c4fe5e4",
"amount": 10
},
{
"_id": "6702467ffc13ae106c4fe5e8",
"__user": "6702467ffc13ae106c4fe5e6",
"amount": 20
},
]
I’d like to filter all orders made by a specific customer but using the power of $search, e.g. passing “Laugh” as string and retrive all orders made by Laughton, so order _id: 6702467ffc13ae106c4fe5e7 .
I need to start the aggregation from orders collection , because of performance and other logic reasons.
If all data I want to search are inside the same collection it works perfectly, but in similar scenario when there are “linked” collections, I really don’t know what do to.
Any help will be appreciated.