For AI agents: a documentation index is available at https://www.mongodb.com/docs/llms.txt — markdown versions of all pages are available by appending .md to any URL path.

Troubleshooting

This document provides advice for troubleshooting problems with MongoDB Vector Search. For direct assistance with MongoDB Vector Search issues, you can either start a discussion on the MongoDB communities on Reddit or Stack Overflow, or contact support.

To use the $vectorSearch pipeline stage to query your cluster, your cluster must run MongoDB 7.0.2+. If you invoke $vectorSearch on an incompatible version of MongoDB, you might see the following error:

OperationFailure: $vectorSearch is not allowed with the currentconfiguration. You may need to enable the corresponding featureflag.

To check the MongoDB version of your cluster:

1
  1. If it's not already displayed, select the organization that contains your desired project from the Organizations menu in the navigation bar.

  2. If it's not already displayed, select your desired project from the Projects menu in the navigation bar.

  3. In the sidebar, click Clusters under the Database heading.

The Clusters page displays.

2

Locate the information pane of the cluster you want to use $vectorSearch on.

3

Consult the Version number in the bottom section of the information pane.

If your cluster runs a version of MongoDB earlier than 6.0.11 or 7.0.2, you must upgrade the MongoDB version of the cluster.

For recommendations on improving query performance, see Benchmark for MongoDB Vector Search.

If $vectorSearch queries return no results, perform the following actions:

  • Ensure that you're using the same embedding model for both your data and your query. If you embed your query using a different model than you use to embed your data, $vectorSearch can't identify matches.

  • Ensure that your MongoDB Vector Search has finished building. When you create or update a MongoDB Vector Search index, the index the index is in an initial sync state. When it finishes building, you can start querying the data in your collection.

When you use LangChain to perform RAG with pre-filtering, you might encounter the following error:

Error during the document retrieval or generation process:MongoServerError: PlanExecutor error during aggregation :: causedby :: Path 'field' needs to be indexed as token

If an index on field exists, ensure you have created this index as a MongoDB Vector Search index, not a MongoDB Search index. If no index on field exists, create one. To learn more about implementing RAG with MongoDB Vector Search and LangChain, see Answer Questions on Your Data.

When you attempt to create a MongoDB Vector Search index programmatically, you might encounter a Command not found error. This error occurs for one of two reasons:

MongoDB Vector Search currently supports filtering only on fields with boolean, date, number, objectId, string, and UUID values. To learn more, see About the filter Type.

The $rerank stage buffers the documents to rerank in memory and enforces the following byte limits on that buffer. It rejects, rather than truncates, any request that exceeds a limit:

  • A single $rerank request can buffer up to 30 MiB of document data. If the request exceeds this limit, the stage fails with error code 65190 and a message similar to the following:

    $rerank request exceeds the per-request memory limit: 1000documents totalling 40.00 MB against a 30 MB limit. ReducenumDocsToRerank, or add a $project before $rerank to excludefields that are not reranked.
  • All concurrent $rerank stages on a node can buffer up to a combined 128 MiB of document data. If a new $rerank request would exceed this limit, the stage fails with error code 65191 and a message similar to the following:

    $rerank cannot be admitted: concurrent $rerank operations onthis node are using 128.00 MB of the 128 MB limit. Retry, orreduce concurrent $rerank load.

To avoid exceeding the per-request limit, reduce numDocsToRerank or use a $project stage before $rerank to exclude fields that you aren't reranking. If you receive the node-wide limit error, retry the query or reduce concurrent $rerank load.