Docs Menu
Docs Home
/ /

$vectorSearch (aggregation stage)

$vectorSearch

$vectorSearch performs a semantic search on data in your Atlas cluster.

If you store vector embeddings on your Atlas cluster, you can seamlessly index the vector data along with your other collection data. You can use the $vectorSearch stage to pre-filter your data and perform semantic search against the indexed fields.

Your vector data must be less than or equal to 4096 dimensions in width.

The $vectorSearch aggregation pipeline stage is available in the following environments:

  • MongoDB Atlas clusters running version 6.0.11 or later

  • MongoDB Enterprise deployments running version 8.2 or later with the Kubernetes Operator

  • MongoDB Community deployments running version 8.2 or later

To learn more, see MongoDB Vector Search.

Starting in MongoDB 8.0, you can use a $vectorSearch stage in a $unionWith stage.

You cannot use a $vectorSearch stage in a $facet stage or a $lookup stage.

Back

$unwind