Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

mongodb-atlas-vector

БесплатноБез исполняемых скриптовНе проверен

MongoDB Atlas Vector Search. $vectorSearch aggregation stage, index definition JSON, quantization (scalar, binary), hybrid with Atlas Search text via…

claude-dev-suiteот claude-dev-suite★ 51 звезда на GitHub

Об этом скилле

MongoDB Atlas Vector Search

Why Atlas Vector Search

Vector Search lives inside MongoDB Atlas alongside your operational data. Kill the ETL:

  • No separate vector DB to sync.
  • Vectors and documents are one row; filtering is just a MongoDB query.
  • Atlas Search index (Lucene) and Vector Search index (hnswlib-derived) are queryable in the same aggregation pipeline.
  • Managed service — sharding, replication, backups handled by Atlas.

Skip it if you are not on Atlas: community MongoDB has no vector search. Use a dedicated vector store instead.

Index Definition (JSON)

Atlas Vector Search indexes are JSON documents. Create via the UI, CLI, or Admin API.

{
  "fields": [
    {
      "type": "vector",
      "path": "embedding",
      "numDimensions": 1024,
      "similarity": "cosine",
      "quantization": "scalar"
    },
    { "type": "filter", "path": "tenant_id" },
    { "type": "filter", "path": "source" },
    { "type": "filter", "path": "created_at" }
  ]
}

Fields marked "type": "filter" are indexed for pre-filter lookups. Unspecified fields still work with $match after retrieval but without the performance benefit.

similarity: cosine, euclidean, or dotProduct. quantization: none, scalar (1 byte/component), binary (1 bit/component) — see below.

Create via PyMongo

# pip install pymongo>=4.7
from pymongo import MongoClient
from pymongo.operations import SearchIndexModel

client = MongoClient(os.environ["MONGODB_URI"])
coll = client["app"]["docs"]

coll.create_search_index(SearchIndexModel(
    definition={
        "fields": [
            {"type": "vector", "path": "embedding",
             "numDimensions": 1024, "similarity": "cosine",
             "quantization": "scalar"},
            {"type": "filter", "path": "tenant_id"},
        ],
    },
    name="docs_vector_idx",
    type="vectorSearch",
))

Index builds asynchronously. Check with coll.list_search_indexes().

$vectorSearch Aggregation Stage

results = coll.aggregate([
    {"$vectorSearch": {
        "index": "docs_vector_idx",
        "path": "embedding",
        "queryVector": q_vec.tolist(),
        "numCandidates": 200,   # ANN candidate pool
        "limit": 10,             # final top-k
        "filter": {
            "tenant_id": "acme",
            "source": {"$in": ["kb", "faq"]},
        },
    }},
    {"$project": {"text": 1, "source": 1,
                  "score": {"$meta": "vectorSearchScore"}}},
])

Rule of thumb: numCandidates between 10x and 20x limit. Too low hurts recall; too high adds latency.

Filters inside $vectorSearch are pre-filters (applied before ANN). A post-$match after the stage filters after, with no performance benefit.

Quantization

Type Storage Recall loss When
none fp32, 4 B/dim 0% Small collections, max quality
scalar 1 B/dim (4x smaller) < 1% Default for production
binary 1 bit/dim (32x smaller) 2-10% raw, recoverable with rescoring Billion-scale

For binary with rescoring, Atlas stores the full float vector alongside the binary; the binary stage shortlists, the full vector rescores the shortlist.

{
  "type": "vector",
  "path": "embedding",
  "numDimensions": 1024,
  "similarity": "cosine",
  "quantization": "binary"
}

Enable numCandidates generously (5-10x final k) when using binary.

Hybrid: Atlas Search ($search) + Vector ($vectorSearch) with $rankFusion

Atlas supports Reciprocal Rank Fusion natively since 8.1:

results = coll.aggregate([
    {"$rankFusion": {
        "input": {
            "pipelines": {
                "vector": [
                    {"$vectorSearch": {
                        "index": "docs_vector_idx",
                        "path": "embedding",
                        "queryVector": q_vec.tolist(),
                        "numCandidates": 200,
                        "limit": 50,
                    }},
                ],
                "text": [
                    {"$search": {
                        "index": "docs_text_idx",
                        "text": {"query": "oauth refresh token",
                                 "path": ["text", "title"]},
                    }},
                    {"$limit": 50},
                ],
            },
        },
        "combination": {"weights": {"vector": 0.6, "text": 0.4}},
    }},
    {"$limit": 10},
    {"$project": {"text": 1, "source": 1,
                  "score": {"$meta": "scoreDetails"}}},
])

Requires both docs_vector_idx (Vector Search) and docs_text_idx (Atlas Search). $rankFusion is RRF under the hood — weighted by the provided weights.

Before 8.1, implement RRF in application code — see rag/hybrid-search.

Dynamic Schema Benefit

Every document can carry arbitrary metadata. A single Vector Search index works across heterogeneous documents:

coll.insert_many([
    {"_id": "d1", "embedding": [...], "tenant_id": "acme", "typ
Полный SKILL.md на GitHub

Установить mongodb-atlas-vector в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Read
Grep
Glob
Write
Edit

FAQ

Что делает скилл mongodb-atlas-vector?

MongoDB Atlas Vector Search. $vectorSearch aggregation stage, index definition JSON, quantization (scalar, binary), hybrid with Atlas Search text via $rankFusion, dynamic schema benefits, sharding, Atlas Triggers for auto-embedding. USE WHEN: user mentions "Atlas Vector Search", "$vectorSearch", "MongoDB vector", "$rankFusion", "Atlas Triggers embedding", "MongoDB HNSW" DO NOT USE FOR: self-hosted vector stores - use `vector-stores/qdrant-advanced`, `vector-stores/milvus`; MongoDB without Atlas (self-hosted) - vector search is an Atlas-only feature

Как установить скилл mongodb-atlas-vector?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл mongodb-atlas-vector запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить mongodb-atlas-vector с