A pipeline like this works as expected:
[{ "$lookup": { "from": "suppliers", "let": { "s": "address.state" }, "as": "details", "pipeline": [ { "$search": { "text": { "query": "green", "path": "description" } } }, { "$match": { "$expr": { "$eq": ["$$s", "$address.state"] } } } ] } } ]
But equivalent expressed with localField/foreignField produces an error.
db.test.aggregate([{ "$lookup": { "from": "suppliers", "localField": "address.state", "foreignField": "address.state", "as": "details", "pipeline": [ { "$search": { "text": { "query": "green", "path": "description" } } } ] } }])
"$_internalSearchMongotRemote is only valid as the first stage in a pipeline"
- related to
-
SERVER-60800 Allow $search in $lookup/$unionWith
- Closed