I’ve tried an aggregate with $lookup and have gotten it close. This narrows down the nested relation, but i’m not sure how to also check the current collection.
[
{
$lookup: {
from: 'users',
localField: 'user',
foreignField: '_id',
as: 'user',
pipeline: [
{
$search: {
index: 'users',
compound: {
should: [
{
search: {
query: "Jim",
path: 'user.firstName',
},
},
],
},
},
},
],
},
},
{ $unwind: '$user' },
]