Is there a way to use text search on a related field?

Is there a way to use either the MongoDB Atlas Search or the older $text search in the aggregation pipeline for a relations field? All the examples for both seem be applying to the top level fields of a collection only

Hi @Ezeikel_Pemberton - Welcome to the community :wave:

Can you provide the following information?:

  • Sample documents
  • What you have attempted so far
  • MongoDB version in use
  • Collection details (I presume there is more than one involved based off the “related field” term but please correct me if I am wrong)
  • Use case details

This will help clarify what you are trying to achieve and will help us seeing if it may be possible or not.

However, please note that starting in MongoDB 6.0, you can specify the Atlas Search $search or $searchMeta stage in the $lookup pipeline to search collections on the Atlas cluster. The $search or the $searchMeta stage must be the first stage inside the $lookup pipeline. More information regarding this here.