How to Run Atlas Search Queries Across Collections
The following tutorials take you through the steps for querying across multiple collections:
The How to Run Atlas Search Queries Using Materialized Views tutorial demonstrates how to index and query on multiple collections using a combination of On-Demand Materialized Views and Atlas App Services Scheduled Triggers.
The How to Run
$lookup
with an Atlas Search$search
Query tutorial demonstrates how to perform cross-collection search by first joining collections in the same database using$lookup
, and then running a query in the sub-pipeline using$search
.The How to Run
$unionWith
with an Atlas Search$search
Query tutorial demonstrates how to search multiple collections using$search
in the$unionWith
aggregation stage sub-pipeline.