| name | mongodb |
| description | MongoDB schema design, aggregation pipelines, indexing strategies, change streams, transactions, and production optimization |
| layer | domain |
| category | database |
| triggers | ["mongodb","mongo","mongoose","nosql","document database","aggregation pipeline"] |
| inputs | ["Data modeling requirements","Query patterns","Scaling requirements"] |
| outputs | ["Schema designs with embedding/referencing strategies","Aggregation pipeline implementations","Indexing and performance recommendations"] |
| linksTo | ["nodejs","python","fastapi","redis","microservices"] |
| linkedFrom | ["error-handling","monitoring"] |
| preferredNextSkills | ["redis","nodejs","microservices"] |
| fallbackSkills | ["postgresql"] |
| riskLevel | low |
| memoryReadPolicy | selective |
| memoryWritePolicy | none |
| sideEffects | [] |
MongoDB Domain Skill
Purpose
Provide expert-level guidance on MongoDB schema design, the embedding vs. referencing trade-off, aggregation pipelines, indexing strategies, change streams, transactions, sharding, and production optimization.
Key Design Principle
Design for your query patterns, not for data normalization. MongoDB schema design is driven by how you read data, not how you write it.
Key Patterns
1. Schema Design: Embed vs. Reference
{
_id: ObjectId("..."),
title: "Understanding MongoDB",
author: {
name: "Jane Doe",
email: "jane@example.com"
},
tags: ["mongodb", "nosql"],
comments: [
{
_id: ObjectId("..."),
user: "Bob",
text: "Great article!",
createdAt: ISODate("2024-01-15")
}
],
createdAt: ISODate("2024-01-10"),
updatedAt: ISODate("2024-01-15")
}
{
: (),
: (),
: [
{
: (),
: ,
:
}
],
: ,
: ,
: ()
}
{
: (),
: ,
: ,
: [
{ : , : , : },
{ : , : , : }
],
: ,
:
}
{
: (),
: (),
: (),
: ,
: ,
: ()
}