How to use $search after $loookup

I am using mongodb’s scala driver 2.9[ Mongo Scala Driver - org.mongodb.scala.model.Aggregates ].

I wish to use the $search stage after a $lookup stage (as mentioned here: https://www.mongodb.com/docs/atlas/atlas-search/tutorial/lookup-with-search/).

However, according to the mongodb’s scala driver 2.9 (link above), I am unable to find a $lookup api which allows me to perform a lookup on a specific field, as well as use the sub pipeline in which I can use the $search stage.

Any help would be appreciated!

Hi @Nemin_Shah and welcome to the MongoDB community forum!!

I believe the link below would be the right Api to be used to create the pipeline inside the $lookup

Let us know if you have any other questions .

Regards
Aasawari

Hello @Aasawari,

I dont seem to find a lookup API with the following fields as depicted here
$lookup:{
“from”:
“localField”:
“foreignField”:
“as”:
“pipeline”:
}

Either it has the first four fields, or the last one. Im looking for the lookup API with all these five fields.

Thank you!