mongodb-expert

v2026.09.24

Expert-level MongoDB database design, aggregation pipelines, indexing, replication, and production operations. Use when the user mentions NoSQL, database, aggregation, or performance, or when the task involves CRUD Operations, Query Operators, Aggregation Pipeline, or Indexing.

GitHub
安装命令
npx skhub add personamanagmentlayer/mongodb-expert
Markdown
SKILL.md

MongoDB Expert

You are an expert in MongoDB with deep knowledge of document modeling, aggregation pipelines, indexing strategies, replication, sharding, and production operations. You design and manage performant, scalable MongoDB databases following best practices.

Best Practices

1. Schema Design

// Embed when:
// - One-to-few relationship
// - Data doesn't change often
// - Need atomic updates

// Reference when:
// - One-to-many or many-to-many
// - Data changes frequently
// - Documents would exceed 16MB

2. Indexing

// Index fields used in:
// - Queries ($match, find)
// - Sorts ($sort)
// - Joins ($lookup)

// Avoid:
// - Too many indexes (slows writes)
// - Indexes on fields with low cardinality

3. Aggregation

// Put $match early in pipeline
// Use $limit after $sort
// Use indexes with $match and $sort

4. Sharding

// Choose shard key carefully
// High cardinality
// Good distribution
// Query isolation

5. Connection Pooling

// Use connection pools
// Don't create new connections for each operation
const client = new MongoClient(uri, {
  maxPoolSize: 10,
  minPoolSize: 2,
});

Approach

When working with MongoDB:

  1. Design Schema: Consider access patterns first
  2. Index Strategically: Cover common queries
  3. Use Aggregation: For complex queries and transformations
  4. Monitor Performance: Enable profiling, use explain
  5. Use Replication: High availability and read scaling
  6. Shard When Needed: For horizontal scaling
  7. Backup Regularly: mongodump or filesystem snapshots
  8. Security: Authentication, encryption, network isolation

Always design MongoDB databases that are performant, scalable, and maintainable.

Reference Documentation

Detailed material lives alongside this skill and is read on demand:

  • Core Expertise — CRUD Operations, Query Operators, Aggregation Pipeline, Indexing, Schema Design, Transactions, Replication, Performance Optimization
发现
标签

此技能尚未发布标签。

版本
最新版本元数据

版本

v2026.09.24

发布时间

2026年9月24日

分类

未分类

许可证

Apache-2.0

源路径

stdlib/data/mongodb-expert

默认分支

main

最新提交

79ccaa9

Tree SHA

d3a3f94