mongodb
MongoDB document database with aggregation pipeline and Atlas. Use for document storage.
Works with
---
name: mongodb
description: MongoDB document database with aggregation pipeline and Atlas. Use for document storage.
license: MIT
---
# MongoDB
MongoDB is a document database. It stores data in JSON-like documents (BSON). It is the most popular NoSQL database, known for flexibility and scalability.
## When to Use
- **Rapid Prototyping**: Schema-less design allows iterating fast without migrations.
- **Content Management**: Storing diverse assets with varying metadata.
- **Catalogs**: Product catalogs where each product has different attributes (size, color, wattage).
## Quick Start
```javascript
// Using Mongoose (Node.js)
const kittySchema = new mongoose.Schema({
name: String,
});
const Kitten = mongoose.model("Kitten", kittySchema);
const silence = new Kitten({ name: "Silence" });
await silence.save();
```
## Core Concepts
### Documents (BSON)
Data is stored in "documents" (JSON objects) inside "collections" (Tables).
`{ "_id": 1, "name": "Apple", "price": 10 }`
### Embedded Data vs References
- **Embed**: Store related data inside the document for fast reads. (e.g., Comments inside a Post).
- **Reference**: Store the ID and look it up (`$lookup`) for many-to-many relationships.
### Sharding
MongoDB scales horizontally by splitting data across multiple servers (shards) based on a "shard key".
## Best Practices (2025)
**Do**:
- **Use Version 8.0+**: For performance gains in time-series and queryable encryption.
- **Index Early**: "Compass" (GUI) or "Atlas Performance Advisor" will tell you when you miss indexes.
- **Limit Array Growth**: Don't use unbounded arrays (e.g., logging every login in the user document).
**Don't**:
- **Don't join everything**: MongoDB supports `$lookup` (JOINS), but overuse kills performance. Embed data if accessed together.
- **Don't ignore Document Size**: Max document size is 16MB.
## References
- [MongoDB Manual](https://www.mongodb.com/docs/manual/)
- [MongoDB University](https://learn.mongodb.com/)More Database skills
prisma-mongodb-upgrade
prisma/skills
Decision and migration guide for Prisma ORM MongoDB projects on v6, which have no upgrade path to v7. Use when a MongoDB project asks about upgrading Prisma, when "upgrade to prisma 7" comes up in a project with provider = "mongodb", or when evaluating a move to Prisma Next. Triggers on "upgrade prisma mongodb", "prisma 7 mongodb", "mongodb prisma migration", "prisma next mongodb".
azure-upgrade
microsoft/azure-skills
Assess and upgrade Azure workloads between plans, tiers, or SKUs, or modernize Azure SDK dependencies in source code. WHEN: upgrade Consumption to Flex Consumption, upgrade Azure Functions plan, change hosting plan, function app SKU, migrate App Service to Container Apps, modernize legacy Azure Java SDKs (com.microsoft.azure to com.azure), migrate Azure Cache for Redis (ACR/ACRE) to Azure Managed Redis (AMR).
azure-cost-optimization
microsoft/azure-skills
Identify Azure cost savings from usage and spending data. USE FOR: optimize Azure costs, reduce Azure spending/expenses, analyze Azure costs, find cost savings, generate cost optimization report, identify orphaned resources to delete, rightsize VMs, reduce waste, optimize Redis costs, optimize storage costs, AKS cost analysis add-on, namespace cost, cost spike, anomaly, budget alert, AKS cost visibility. DO NOT USE FOR: deploying resources (use azure-deploy), general Azure diagnostics (use azure-diagnostics), security issues (use azure-security)

