mongodb
Lets your agent manage MongoDB databases. Useful for setting up and keeping MongoDB running efficiently and securely.
What it does
MongoDB is a database that stores information in document format, like organized text files. It's good for when you have data that changes a lot or is complex.
When to use it
- ✓You need to store data that doesn't have a fixed structure.
- ✓Your data looks like JSON files, with a lot of information inside others.
- ✓Your application needs to scale to handle many users or large amounts of data.
Example of what to ask your AI
“How do I install MongoDB on a Linux server?”
Want more? Open the sections below.
How to use
The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.
Skill link
Ready-to-paste message
How it works
MongoDB works by storing data in documents. It allows you to organize, search, and modify this data efficiently. It can be configured to run on multiple servers simultaneously for increased reliability and speed.
Installation
Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.
In the terminal (Claude Code, Codex, Cursor), in your project folder:
npx skills add sickn33/agentic-awesome-skills --skill mongodbOr download just the file:
curl -L https://raw.githubusercontent.com/sickn33/agentic-awesome-skills/main/plugins/agentic-awesome-skills-claude/skills/mongodb/SKILL.md -o SKILL.mdTechnical content (original SKILL.md)
Original text by the author, straight from GitHub.
MongoDB
Administer, optimize, and secure MongoDB NoSQL databases in development and production environments.
When to Use
- You need a document-oriented database with flexible schemas.
- Your data is semi-structured or heavily nested (JSON-like documents).
- You need horizontal scaling through sharding.
- Your application benefits from rich querying and aggregation pipelines.
Prerequisites
- Linux server (Debian/Ubuntu or RHEL-based) or Docker.
- Root or sudo access for package installation.
- MongoDB 7.x recommended for production (6.x still supported).
Installation and Setup
# Debian / Ubuntu — MongoDB 7
curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | \
sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg --dearmor
echo "deb [ signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] \
https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | \
sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list
sudo apt update
sudo apt install -y mongodb-org
# Start and enable
sudo systemctl enable --now mongod
# Verify
mongosh --eval "db.version()"
Initial User Setup
// Connect without auth first
// mongosh
use admin
// Create admin user
db.createUser({
user: "admin",
pwd: "strong_admin_password",
roles: [
{ role: "userAdminAnyDatabase", db: "admin" },
{ role: "readWriteAnyDatabase", db: "admin" },
{ role: "clusterAdmin", db: "admin" }
]
})
// Create an application-scoped user
use mydb
db.createUser({
user: "myapp",
pwd: "strong_app_password",
roles: [{ role: "readWrite", db: "mydb" }]
})
Enable authentication in /etc/mongod.conf:
security:
authorization: enabled
sudo systemctl restart mongod
# Now connect with credentials
mongosh -u myapp -p strong_app_password --authenticationDatabase mydb
mongosh Commands Reference
// Show databases and collections
show dbs
use mydb
show collections
// Insert documents
db.users.insertOne({ name: "Alice", email: "alice@example.com", age: 30 })
db.users.insertMany([
{ name: "Bob", email: "bob@example.com", age: 25 },
{ name: "Carol", email: "carol@example.com", age: 35 }
])
// Query documents
db.users.find({ age: { $gte: 25 } }).sort({ name: 1 }).limit(10)
db.users.findOne({ email: "alice@example.com" })
db.users.countDocuments({ age: { $gte: 30 } })
// Update
db.users.updateOne(
{ email: "alice@example.com" },
{ $set: { age: 31 }, $currentDate: { updatedAt: true } }
)
db.users.updateMany(
{ age: { $lt: 30 } },
{ $set: { tier: "junior" } }
)
// Delete
db.users.deleteOne({ email: "bob@example.com" })
db.users.deleteMany({ tier: "junior" })
Indexing
// Single-field index
db.users.createIndex({ email: 1 }, { unique: true })
// Compound index
db.orders.createIndex({ userId: 1, createdAt: -1 })
// Text index for search
db.articles.createIndex({ title: "text", body: "text" })
db.articles.find({ $text: { $search: "mongodb scaling" } })
// TTL index — auto-delete documents after 30 days
db.sessions.createIndex({ createdAt: 1 }, { expireAfterSeconds: 2592000 })
// List indexes
db.users.getIndexes()
// Drop an index
db.users.dropIndex("email_1")
// Explain a query to verify index usage
db.orders.find({ userId: 42 }).explain("executionStats")
Aggregation Pipeline Examples
// Revenue per status
db.orders.aggregate([
{ $group: {
_id: "$status",
totalRevenue: { $sum: "$total" },
count: { $sum: 1 }
}},
{ $sort: { totalRevenue: -1 } }
])
// Top 5 customers by order value (with a join)
db.orders.aggregate([
{ $group: {
_id: "$userId",
spent: { $sum: "$total" },
orderCount: { $sum: 1 }
}},
{ $sort: { spent: -1 } },
{ $limit: 5 },
{ $lookup: {
from: "users",
localField: "_id",
foreignField: "_id",
as: "user"
}},
{ $unwind: "$user" },
{ $project: {
_id: 0,
name: "$user.name",
email: "$user.email",
spent: 1,
orderCount: 1
}}
])
// Daily signup trend
db.users.aggregate([
{ $group: {
_id: { $dateToString: { format: "%Y-%m-%d", date: "$createdAt" } },
signups: { $sum: 1 }
}},
{ $sort: { _id: 1 } },
{ $limit: 30 }
])
Replica Set Setup
A replica set requires a minimum of three members (or two data-bearing nodes plus an arbiter).
Configuration File for Each Member
# /etc/mongod.conf (adjust port and dbPath per member)
storage:
…
FAQ
What is a 'replica set'?
It's a group of MongoDB servers working together to ensure your data is always available and safe, even if one server fails.
How do I back up my data?
You can use tools like `mongodump` to create backups of your data and `mongorestore` to restore them if needed.
What is 'sharding'?
Sharding is a technique to split your data across multiple servers. This helps the database handle massive amounts of information and respond faster.
Details
Original description by the author
Administer MongoDB databases. Configure replica sets, sharding, and backups. Use when managing MongoDB deployments.
Popularity
- GitHub stars
- 48k
- Ranking position
- #3617
- License
- MIT
- Updated
- 10/15/2026
Comments
- …
More skills from this repository
00-andruia-consultant
Helps your agent start or improve AI projects. It analyzes code, suggests tools, and creates action plans in Spanish.
sickn33/agentic-awesome-skills
007
Lets your agent perform security audits and threat modeling. It's useful for protecting projects against attacks and vulnerabilities.
sickn33/agentic-awesome-skills
10-andruia-skill-smith
Helps your agent create or improve AI tools. It defines how tools work, writes documentation, and validates the structure.
sickn33/agentic-awesome-skills
20-andruia-niche-intelligence
Lets your agent create a summary about a specific industry. It's useful for understanding the context, rules, usage patterns, and risks of a project, using reliable sources.
sickn33/agentic-awesome-skills
Similar skills
api-connector-builder
Has your agent build new API connections following the existing pattern. Use when you need to add one more integration without creating a new way of doing things.
affaan-m/ECC
api-design
Helps your agent design REST APIs following best practices. It's useful for defining how APIs communicate, how errors are shown, and how to organize data.
affaan-m/ECC
backend-patterns
Helps your agent with server-side architecture patterns and database optimization. It's useful for building or reviewing code that runs on the server.
affaan-m/ECC