Practical MongoDB and Mongoose guidance covering schema design, query operators, updates, and aggregation pipelines with production-minded defaults.

CCM score
53 of 100
skills.sh installs
1.7K
GitHub stars
303
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers native driver CRUD, Mongoose connection setup, schema definition, embedded versus referenced documents, virtuals, and query builder usage
  • Includes annotated examples for indexes, text search, populate chains, update operators such as $set, $push, and $addToSet, and upserts
  • Enforces defaults such as select: false on passwords, timestamps, lean() reads, and runValidators on updates
  • Designed for Node.js developers building document-backed APIs who need MongoDB Atlas or Mongoose conventions

Install

$ npx -y skills add hoodini/ai-agents-skills --skill mongodb -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

MongoDB & Mongoose

Build and query MongoDB databases with best practices.

Quick Start

npm install mongodb mongoose

Native Driver

import { MongoClient, ObjectId } from 'mongodb';

const client = new MongoClient(process.env.MONGODB_URI!);
const db = client.db('myapp');
const users = db.collection('users');

// Connect
await client.connect();

// CRUD Operations
await users.insertOne({ name: 'Alice', email: 'alice@example.com' });
const user = await users.findOne({ email: 'alice@example.com' });
await users.updateOne({ _id: user._id }, { $set: { name: 'Alice Smith' } });
await users.deleteOne({ _id: user._id });

Mongoose Setup

import mongoose from 'mongoose';

await mongoose.connect(process.env.MONGODB_URI!, {
  maxPoolSize: 10,
  serverSelectionTimeoutMS: 5000,
  socketTimeoutMS: 45000,
});

// Connection events
mongoose.connection.on('connected', () => console.log('MongoDB connected'));
mongoose.connection.on('error', (err) => console.error('MongoDB error:', err));
mongoose.connection.on('disconnected', () => console.log('MongoDB disconnected'));

Details

Repository
github.com/hoodini/ai-agents-skills
Categories
Databases, Backend & APIs

More from hoodini/ai-agents-skills

All 35

Similar to Mongodb

More Databases