Skip to content
Back to skills

Mongodb

ASecurity

MongoDB — document modelling (embed vs reference) by access patterns, indexes and the ESR rule, aggregation pipelines, transactions and write concerns, schema validation, sharding keys, change streams. Use for MongoDB data modelling and queries (MongoDB, document model, aggregation, sharding, indexes).

  • 5 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 3, 2026
ai-agentsgosql

Security analysis

A100/100

Scanned December 3, 2026

npx -y skills add vectora-os/kit --skill mongodb --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Mongodb?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Mongodb
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectora-os-mongodb/badge)](https://www.skillsdirectory.com/skills/vectora-os-mongodb)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: mongodb
description: MongoDB — document modelling (embed vs reference) by access patterns, indexes and the ESR rule, aggregation pipelines, transactions and write concerns, schema validation, sharding keys, change streams. Use for MongoDB data modelling and queries (MongoDB, document model, aggregation, sharding, indexes).
metadata:
  category: data
---

# MongoDB

## Purpose

Model documents around access patterns while keeping data consistent.

**Use when:** MongoDB schemas and queries.

**Not for:** relational workloads better served by SQL.

## Inputs

- Access patterns, data sizes.

## Outputs

- Document models, indexes, validation rules.

## Read first

- [Project Brain](../../../project-brain/README.md) — `npm run brain -- query "mongodb"` for prior decisions, patterns and anti-patterns.

## Steps

1. **Model.** Embed data read together; reference unbounded or shared data.
   Done when no unbounded arrays.
2. **Index.** Compound indexes by Equality-Sort-Range.
   Done when queries are covered or indexed.
3. **Validate.** JSON schema validation on collections.
   Done when invalid writes rejected.
4. **Consistency.** Set write concern majority for critical data; transactions sparingly.
   Done when durability settings documented.

## Best practices

- Explain plans for every hot query.
- Pick shard keys with high cardinality and even distribution.

## Common mistakes

- Schemaless chaos.
- Monotonic shard keys.

## Example

Order with embedded line items, referenced customer; index `{customerId:1, createdAt:-1}`.

## Reusable prompt

```text
Apply the MongoDB skill (.agents/skills/mongodb/SKILL.md).
Context: {{task card or question; links to PRD, ADRs, code paths}}
Constraints: {{approved thresholds, deadlines, allowed files}}
Model the documents from access patterns and define indexes, validation and write concerns.
Return: Document models, indexes, validation rules..
Cite evidence (file:line, command output, source) for every claim; list open questions separately.
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.