New advertisers: 50% off your first month with code FIRSTMONTHSee slots

Guide to MongoDB in Node.js with Mongoose for schemas, CRUD, relationships, and aggregation queries.

skills.sh installs
702
GitHub stars
2
last updated
Aug 21, 2026
View on GitHub

What it does

  • Covers connection setup, schema and model definition, CRUD operations, and population of related documents
  • Includes examples for indexes, pre-save middleware, virtual properties, aggregation pipelines, and query operators
  • Recommends schema-level validation, lean() for read-only queries, and transactions for multi-document writes
  • Designed for Node.js applications that need a flexible, document-based data store

Install

$ npx -y skills add pluginagentmarketplace/custom-plugin-nodejs --skill mongoose-mongodb -y

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

Files

Mongoose & MongoDB Skill

Master MongoDB database integration in Node.js with Mongoose, the elegant object modeling library.

Quick Start

Connect and CRUD in 4 steps:

  1. Install - npm install mongoose
  2. Connect - mongoose.connect(uri)
  3. Define Schema - Create data models
  4. CRUD - Create, Read, Update, Delete

Core Concepts

Connection Setup

const mongoose = require('mongoose');

mongoose.connect(process.env.MONGODB_URI, {
  useNewUrlParser: true,
  useUnifiedTopology: true
});

mongoose.connection.on('connected', () => {
  console.log('MongoDB connected');
});

Schema & Model

const userSchema = new mongoose.Schema({
  name: {
    type: String,
    required: [true, 'Name is required'],
    trim: true,
    minlength: 3,
    maxlength: 50
  },
  email: {
    type: String,
    required: true,
    unique: true,
    lowercase: true
  },
  age: {
    type: Number,
    min: 18,
    max: 120
  },
  role: {
    type: String,
    enum: ['user', 'admin'],
    default: 'user'
  }
}, {
  timestamps: true  // createdAt, updatedAt
});

const User = mongoose.model('User', userSchema);

Details

Repository
github.com/pluginagentmarketplace/custom-plugin-nodejs
Categories
Databases, Backend & APIs
First seen
May 16, 2026

More from pluginagentmarketplace/custom-plugin-nodejs

All 4

Similar to Mongoose Mongodb

More Databases