-
Type: Task
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: None
-
Labels:None
This change allows usage of localField/foreignField in $lookup pipeline with $search
Description of Linked Ticket
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"
Scope of Changes
Spoke with kanchana.sekhar@mongodb.com on this. What we want to do on the server docs side is:
- Mention this change in the release notes
- Add a sub-section to the Examples section of $lookup called "$search Examples" and link out to the new tutorials being created in the Atlas Search docs.
Timing
Not required for World. The tutorials will be written post World.
- documents
-
SERVER-65808 $search as subpipeline of $lookup with localField+foreignField is not supported
- Closed
- has to be finished together with
-
DOCS-15254 Investigate changes in SERVER-60800: Allow $search in $lookup/$unionWith
- Closed
- is documented by
-
DOCS-15300 [Atlas Search] Add $lookup and $unionwith
- Closed
- is duplicated by
-
DOCS-15301 [Atlas Search] Tutorial for $unionwith & $lookup in $search
- Closed
- related to
-
DOCS-15301 [Atlas Search] Tutorial for $unionwith & $lookup in $search
- Closed