Skip to content
Back to skills

Senior Mongodb

ASecurity

Use when designing, reviewing, tuning, migrating, securing, or troubleshooting MongoDB data models, documents and schemas, indexes, queries and aggregation pipelines, explain plans, transactions, Mongoose or driver code, sharding, replication, or backups.

  • 2 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 26, 2026
ai-agentsgotesting

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned November 26, 2026

npx -y skills add a365ngay/CogniRouter --skill senior-mongodb --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Senior Mongodb?

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

Security grade badge for Senior Mongodb
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/a365ngay-senior-mongodb/badge)](https://www.skillsdirectory.com/skills/a365ngay-senior-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: senior-mongodb
description: Use when designing, reviewing, tuning, migrating, securing, or troubleshooting MongoDB data models, documents and schemas, indexes, queries and aggregation pipelines, explain plans, transactions, Mongoose or driver code, sharding, replication, or backups.
---

# Senior MongoDB

## Role

Model MongoDB data around access patterns, back every frequent query with an index, keep documents bounded, and change schemas without breaking existing documents.

## Before Editing

1. Inspect server version, deployment (replica set, sharded, Atlas), driver or ODM (Mongoose, Motor, official drivers), schema validation rules, existing indexes, and migration approach.
2. List the read and write patterns affected and get `explain("executionStats")` for changed queries.
3. Never run destructive operations or index builds on production without authorization and a plan.

## Implementation Rules

- Embed data that is read together and bounded; reference data that grows without limit or is shared. Never let arrays grow unbounded inside a document (16 MB limit, update cost).
- Create compound indexes following equality, sort, range order; verify queries are covered or use `IXSCAN`, not `COLLSCAN`. Remove unused indexes.
- Validate input before building queries; never pass user-controlled objects directly as filters (operator injection such as `$where`, `$ne`). Use projections to return only needed fields.
- Use multi-document transactions only when invariants span documents; keep them short. Prefer atomic single-document updates (`$set`, `$inc`, `$push` with `$slice`).
- Evolve schemas with a version field or tolerant readers; backfill in batches; add `$jsonSchema` validation for new invariants.
- Choose read/write concerns deliberately; for sharded clusters pick shard keys with high cardinality and even distribution.

## Testing and Verification

Check `explain` output for changed queries and aggregations, run tests against a real MongoDB (container) rather than mocks for query logic, and verify migrations on a copy of production-shaped data.

## Review Checklist

- Does the model match access patterns, with bounded documents?
- Is every hot query index-backed?
- Is user input sanitized against operator injection?
- Can old and new document shapes coexist during rollout?

Files in this skill

  • SKILL.md2.3 KB
  • agents/openai.yaml195 B

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.