Skip to content

fix: upgrade MongoDB vector store from deprecated knnVector to vectorSearch (#3970)#4

Open
themavik wants to merge 1 commit intomainfrom
fix/3970-mongodb-knnvector-deprecated
Open

fix: upgrade MongoDB vector store from deprecated knnVector to vectorSearch (#3970)#4
themavik wants to merge 1 commit intomainfrom
fix/3970-mongodb-knnvector-deprecated

Conversation

@themavik
Copy link
Owner

@themavik themavik commented Feb 9, 2026

Fixes mem0ai#3970.

Root cause: MongoDB Atlas deprecated knnVector index type. Also numCandidates was set equal to limit, resulting in poor recall.

Fix: Use vectorSearch index type with fields array format, numDimensions instead of dimensions, and increase numCandidates to limit * 10.

…Search (mem0ai#3970)

Root cause: MongoDB Atlas moved Vector Search to GA, deprecating the
knnVector index type and legacy mappings syntax. Additionally,
numCandidates was set equal to limit, resulting in poor recall for
HNSW indexes.

Fix: Use vectorSearch index type with fields array format,
numDimensions instead of dimensions, and increase numCandidates
to limit * 10 for better search accuracy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MONGODB BUG FIX: knnVector is deprecated

1 participant