Command Palette

Search for a command to run...

Назад к скиллам
скилл № 74021

MongoDB

Designs MongoDB schemas, indexes, and aggregation pipelines, and debugs slow queries, connection errors, and replica set failures. Use when modeling…

БесплатноБез исполняемых скриптов
clawicот clawic★ 23 звезды на GitHub

Установить MongoDB в Claude Code и Claude Desktop

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

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

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

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

User preferences and memory live in ~/Clawic/data/mongodb/ (see setup.md on first use, memory-template.md for the file format). If you have data at an old location (~/mongodb/ or ~/clawic/mongodb/), move it to ~/Clawic/data/mongodb/, and say in one line that you moved it and from where.

When To Use

  • Designing or reviewing document schemas: embed vs reference, growing arrays, multi-tenant layout, versioned shapes
  • A query, pipeline, or dashboard is slow: reading explain plans, designing compound indexes, killing a scan
  • Building or debugging aggregation pipelines, $lookup joins, materialized views, window functions
  • Connecting an application: connection strings, pooling, timeouts, retries, ODM behavior, serverless clients
  • Operating production: replica sets, sharding, write and read concerns, backups, upgrades, security, Atlas
  • A live incident: no primary, connection storm, disk full, runaway operation, cache stall, blown oplog window
  • Not for SQL or relational databases — normalization instincts from relational design actively mislead here (see Related Skills)

Quick Reference

Situation Play
Query is slow, cause unknown explain("executionStats") before touching anything; triage order in slow-queries.md
explain shows COLLSCAN No usable index, or the index exists in the wrong field order — check ESR before creating another (→ indexes.md)
totalDocsExamined far above nReturned Index is not selective enough for this shape; the ratio target is Core Rule 1
Embed or reference this relationship? Three questions in order: read together, bounded, independently updated (→ schema.md)
An array grows once per user action Never embed it — child collection or time-series collection (Core Rule 3)
Pipeline aborts "exceeded memory limit" A blocking stage hit its 100MB budget: index the sort or reshape upstream (→ aggregation.md)
find().sort() fails on memory Different limit: 32MB in-memory sort for find, not the pipeline's 100MB (→ slow-queries.md)
$lookup inside a hot query A schema signal, not a tuning problem: extended reference or embed (→ schema.md)
Deep pagination (skip in the tens of thousands) Range on the sort key: {_id: {$gt: lastSeenId}} — constant cost per page
"not writable primary", server selection timed out Topology or failover, not your query (→ errors.md, then connections.md)
Latency spikes right after a deploy Pool math: pods × maxPoolSize (Core Rule 8) or Mongoose autoIndex rebuilding on boot (→ connections.md)
Cursor died mid-iteration (code 43) 10-minute idle cursor timeout — re-query by range per batch (→ connections.md)
Duplicate key error on an optional field Plain unique index counts two missing fields as duplicate nulls — partial unique index (→ indexes.md)
Secondary lagging, oplog window shrinking → replication.md; flow control and the resync threshold live there
Majority writes hang after losing one node PSA topology trap (→ replication.md)
One shard absorbs all the writes Monotonic shard key (→ sharding.md)
Full-text, fuzzy, faceted, or vector search The built-in text index is the wrong tool past basic keyword match (→ search.md)
React to writes: CDC, cache invalidation, outbox Change streams, resume tokens, oplog window (→ change-streams.md)
Changing a field's shape under live traffic Expand → dual-write → backfill in batches → contract (→ migrations.md)
Metrics, events, or sensor readings by timestamp Time-series collection, not a normal collection with a date index (→ time-series.md)
Multi-document invariant across collections Try to co-locate it first; transactions with a retry loop if you cannot (→ transactions.md)
Database reachable from the internet Auth, bindIp, and TLS audit before anything else (→ security.md)
An error code or message to decode Error Codes below; full catalog with fixes in errors.md
Anything else Reproduce with the smallest find() that still shows it, explain() before and after every change; if production is stuck, read db.currentOp() before you change a thing

Depth on demand, by phase:

  • Diagnose — slow-queries.md explain plans and triage · errors.md code to cause · incidents.md no primary, disk full, connection storm, cache stall · monitoring.md what to watch and alert on · mongosh.md the shell toolkit
  • Design — schema.md embed vs reference and the pattern catalog · indexes.md ESR, index types, lifecycle · aggregation.md pipeline craft · time-series.md measurements over time · search.md text and vector search
  • Change — migrations.md online schema change, backfills, bulk loading · transactions.md sessions and retry loops · change-streams.md reacting to writes
  • Operate — connections.md drivers, pools, timeouts, ODMs · replication.md replica sets, concerns, oplog, upgr
Полный SKILL.md на GitHub

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

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

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

  • _meta.json
  • aggregation.md
  • atlas.md
  • backups.md
  • change-streams.md
  • connections.md
  • errors.md
  • incidents.md
  • indexes.md
  • memory-template.md
  • migrations.md
  • mongosh.md
  • monitoring.md
  • replication.md
  • schema.md
  • search.md
  • security.md
  • setup.md
  • sharding.md
  • slow-queries.md
  • time-series.md
  • transactions.md
  • tuning.md

FAQ

Что делает скилл MongoDB?

Designs MongoDB schemas, indexes, and aggregation pipelines, and debugs slow queries, connection errors, and replica set failures. Use when modeling documents, deciding embed vs reference, reading an explain plan, or fixing a COLLSCAN, and when a query times out, a pipeline aborts at the memory limit, a cursor dies mid-loop, the pool exhausts and server selection times out, writes fail with duplicate key or "not writable primary", a secondary lags, the oplog window closes, a shard key hotspots, or WiredTiger cache stalls the cluster. Covers mongosh and Compass, Atlas, Mongoose and driver connection strings, transactions and retry loops, change streams, time-series collections, Atlas Search and vector search, sharding, backups, restores, and upgrades. Not for SQL or relational modeling — normalization instincts actively mislead here.

Как установить скилл MongoDB?

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

Скилл MongoDB запускает скрипты?

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

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

Сравнить MongoDB с