Skip to content
Development
Skill

/database-mongodb

Apply MongoDB data-modeling, indexing, and query rules from access patterns. Use when designing schemas, choosing embed vs reference, or tuning MongoDB query behavior.

From plugin
agent-skills-standard
583200 skills21 agents33 commands1 MCP

Claude Code

$ npx -y skills add hoangnguyen0403/agent-skills-standard --skill database-mongodb --agent claude-code

SKILL.md

database-mongodb.SKILL.md
name: database-mongodb
description: Apply MongoDB data-modeling, indexing, and query rules from access patterns. Use when designing schemas, choosing embed vs reference, or tuning MongoDB query behavior.
metadata:
  triggers:
    files:
    - '**/*.ts'
    - '**/*.js'
    - '**/*.json'
    keywords:
    - mongo
    - mongoose
    - mongoose model
    - mongodb model
    - objectid
    - schema
  upstream:
    - name: mongodb
      source: github
      repo: mongodb/mongo
      pinned: "8.0.0"
      tag_pattern: "^r(\\d+\\.\\d+\\.\\d+)$"
      reviewed: "2026-06-17"

MongoDB Best Practices

**Priority: P0 (CRITICAL)**

Rules

  • Model from access patterns: data read together should usually live together.
  • Embed for bounded one-to-few data; reference for unbounded growth or independent lifecycle.
  • Build indexes for real queries, not theoretical flexibility. Use ESR ordering for equality -> sort -> range compound indexes.
  • Use transactions only when single-document guarantees are insufficient.

Verify

  • [ ] Embed vs reference choice matches cardinality and lifecycle.
  • [ ] Compound index order matches equality -> sort -> range access.
  • [ ] Large pagination uses cursor patterns, not deep `skip()`.
  • [ ] Explain output supports the chosen indexes; review `keysExamined` and `docsExamined`.
  • [ ] Unbounded arrays and hot shard keys were reviewed.

Anti-Patterns

  • **No unbounded arrays**: Use `$push` with `$slice` or redesign using Bucket Pattern.
  • **No client-side filtering**: Project only needed fields; never fetch full docs to filter in memory.
  • **No deep nesting**: Keep nesting ≤4 levels; flatten paths that frequently queried.
  • **No index cargo cult**: each index must map to a read path and write tradeoff.

References

  • [Framework Map](../references/framework-map.md)
  • [Best Practices Guide](references/best-practices.md)
  • [Anti-Patterns](references/anti-patterns.md)
  • [Postgres vs Mongo Comparison](references/postgres-comparison.md)
Read more
@hoangnguyen0403
Ships withagent-skills-standard

The portable standards layer for AI coding agents. Sync once, then work in your own runtime.

583200 skills21 agents1 MCP
Get the whole plugin

Stars on GitHub

Momentum

stars in total
583
Star history of hoangnguyen0403/agent-skills-standard on GitHub, a chart by star-history.com

Other skills on agent-skills-standard.

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills13d309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc2w293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react4d252k
@facebook@facebookInstall Skill

Questions about database-mongodb.

Which coding agents can use database-mongodb?
database-mongodb installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.