mongodb-crud-operations
Master MongoDB CRUD operations, document insertion, querying, updating, and deletion. Learn BSON format, ObjectId, data types, and basic operations. Use when working with documents, collections, and fundamental MongoDB operations.
Best use case
mongodb-crud-operations is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Master MongoDB CRUD operations, document insertion, querying, updating, and deletion. Learn BSON format, ObjectId, data types, and basic operations. Use when working with documents, collections, and fundamental MongoDB operations.
Teams using mongodb-crud-operations should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/mongodb-crud-operations/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How mongodb-crud-operations Compares
| Feature / Agent | mongodb-crud-operations | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Master MongoDB CRUD operations, document insertion, querying, updating, and deletion. Learn BSON format, ObjectId, data types, and basic operations. Use when working with documents, collections, and fundamental MongoDB operations.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# MongoDB CRUD Operations
Master fundamental MongoDB Create, Read, Update, Delete operations.
## Quick Start
### Connect to MongoDB
```javascript
const { MongoClient } = require('mongodb');
const client = new MongoClient('mongodb://localhost:27017');
await client.connect();
const db = client.db('myapp');
const users = db.collection('users');
```
### Create Documents
```javascript
// Insert one document
const result = await users.insertOne({
name: 'John Doe',
email: 'john@example.com',
age: 30,
createdAt: new Date()
});
console.log('Inserted ID:', result.insertedId);
// Insert multiple documents
await users.insertMany([
{ name: 'Alice', email: 'alice@example.com' },
{ name: 'Bob', email: 'bob@example.com' }
]);
```
### Read Documents
```javascript
// Find one document
const user = await users.findOne({ email: 'john@example.com' });
// Find all documents
const allUsers = await users.find({}).toArray();
// Find with filter
const activeUsers = await users.find({ status: 'active' }).toArray();
// Find by ObjectId
const { ObjectId } = require('mongodb');
const user = await users.findOne({ _id: new ObjectId('...') });
```
### Update Documents
```javascript
// Update one document
const result = await users.updateOne(
{ email: 'john@example.com' },
{ $set: { age: 31, updatedAt: new Date() } }
);
// Update multiple documents
await users.updateMany(
{ status: 'inactive' },
{ $set: { lastNotified: new Date() } }
);
// Replace entire document
await users.replaceOne(
{ _id: userId },
{ name: 'New Name', email: 'new@example.com' }
);
```
### Delete Documents
```javascript
// Delete one document
await users.deleteOne({ email: 'john@example.com' });
// Delete multiple documents
await users.deleteMany({ status: 'deleted' });
// Delete all documents (careful!)
await users.deleteMany({});
```
## BSON Data Types
```javascript
// String
{ name: 'John' }
// Number (int32, int64, double)
{ age: 30, price: 19.99 }
// Boolean
{ isActive: true }
// Date
{ createdAt: new Date() }
// Array
{ tags: ['mongodb', 'database', 'nosql'] }
// Object (embedded document)
{ address: { city: 'New York', zip: '10001' } }
// ObjectId (default _id field)
{ _id: ObjectId('507f1f77bcf86cd799439011') }
// Null
{ description: null }
// Binary Data
{ image: Buffer.from('data') }
// Regular Expression
{ email: /.*@example\.com/ }
```
## Key Concepts
- **_id Field**: Automatically generated ObjectId, unique identifier
- **Collections**: Tables equivalent in SQL
- **Documents**: JSON-like records (up to 16MB)
- **Field Names**: Case-sensitive, cannot start with $
- **Operators**: $set, $inc, $push, $pull, $unset, etc.
## Python Example (PyMongo)
```python
from pymongo import MongoClient
from datetime import datetime
client = MongoClient('mongodb://localhost:27017')
db = client['myapp']
users = db['users']
# Insert
result = users.insert_one({
'name': 'John',
'email': 'john@example.com',
'createdAt': datetime.now()
})
# Read
user = users.find_one({'email': 'john@example.com'})
# Update
users.update_one(
{'_id': result.inserted_id},
{'$set': {'age': 30}}
)
# Delete
users.delete_one({'_id': result.inserted_id})
```
## Best Practices
✅ Always handle errors with try-catch
✅ Use connection pooling
✅ Close connections properly
✅ Use ObjectId for _id fields
✅ Validate data before insertion
✅ Use appropriate write concerns
✅ Index frequently queried fields
✅ Plan for schema evolutionRelated Skills
MongoDB with Mongoose
Database patterns for user data and credentials storage
mongodb-expert
MongoDB document modeling, aggregation pipeline optimization, sharding strategies, replica set configuration, connection pool management, and indexing patterns. Use this skill for MongoDB-specific issues, NoSQL performance optimization, and schema design.
mongodb-development
MongoDB development guidelines with Payload CMS, Mongoose, aggregation pipelines, and TypeScript best practices.
MongoDB Best Practices
Expert rules for schema design, indexing, and performance in MongoDB (NoSQL).
memos_crud
Perform CRUD operations on a Memos instance (create, read, update, delete memos).
Developing with MongoDB
The agent implements MongoDB NoSQL database solutions with document modeling, aggregation pipelines, and Mongoose ODM. Use when building document-based applications, designing schemas, writing aggregations, or implementing NoSQL patterns.
admin-crud
Generate admin dashboard pages with data tables, filters, bulk actions, dialogs, and forms. Use when building admin interfaces, management pages, or dashboard components.
u01482-constraint-compilation-for-healthcare-operations
Operate the "Constraint Compilation for healthcare operations" capability in production for healthcare operations workflows. Use when mission execution explicitly requires this capability and outcomes must be reproducible, policy-gated, and handoff-ready.
Operations & Growth Expert
专注于内容创作(文案、运营稿件)、运营数据分析、以及营销活动策划与设置。帮助项目实现从“可用”到“好用”及“增长”的闭环。
mongodb-schema-design
Master MongoDB schema design and data modeling patterns. Learn embedding vs referencing, relationships, normalization, and schema evolution. Use when designing databases, normalizing data, or optimizing queries.
async-operations
Specifies the preferred syntax for asynchronous operations using async/await and onMount for component initialization. This results in cleaner and more readable asynchronous code.
search-operations
Search GitHub - find code, issues, users, and repositories across GitHub using gh CLI