Details
Description
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"
Attachments
Issue Links
- is documented by
-
DOCS-15298 [Server] Investigate changes in SERVER-65808: $search as subpipeline of $lookup with localField+foreignField is not supported
-
- Closed
-
- related to
-
SERVER-60800 Allow $search in $lookup/$unionWith
-
- Closed
-