# mongoose-mongodb

This skill helps connect MongoDB to Node.js with Mongoose, covering schemas, CRUD work, document links, and advanced queries.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 691 installs · ★ 2
- Author: pluginagentmarketplace
- License: LicenseRef-Proprietary · policy=link-only · description only; the file stays with the author
- Source: https://github.com/pluginagentmarketplace/custom-plugin-nodejs/tree/HEAD/skills/mongoose-mongodb/SKILL.md
- Updated: 2026-01-07
- HTML: https://affpapa.org/en/nevibecode/skills/mongoose-mongodb

## What it does

The skill guides an agent through MongoDB integration in Node.js with Mongoose. It covers connection setup, schemas and models, CRUD operations, document relationships, population, validation, indexes, middleware, virtual fields, and aggregation pipelines.

It can shape queries with comparison and logical conditions, array filters, and regular expressions. The project needs the `mongoose` package, and the connection string should come from the `MONGODB_URI` environment variable. Without that variable, the database connection cannot be configured.

The material also covers transactions for multi-document work, read-only queries with `lean()`, connection error handling, and closing the connection when the application stops. It is aimed at Node.js applications using JSON-like MongoDB data.

## Requirements
- Works with: MongoDB

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add pluginagentmarketplace/custom-plugin-nodejs --skill mongoose-mongodb -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/mongoose-mongodb/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/mongoose-mongodb/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add pluginagentmarketplace/custom-plugin-nodejs --skill mongoose-mongodb -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/mongoose-mongodb/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add pluginagentmarketplace/custom-plugin-nodejs --skill mongoose-mongodb -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/mongoose-mongodb/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install pluginagentmarketplace/custom-plugin-nodejs mongoose-mongodb
```

2. **Manually: put the files in place**
- File: `.github/skills/mongoose-mongodb/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add pluginagentmarketplace/custom-plugin-nodejs --skill mongoose-mongodb -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/pluginagentmarketplace/custom-plugin-nodejs --path skills/mongoose-mongodb
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/mongoose-mongodb/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add pluginagentmarketplace/custom-plugin-nodejs --skill mongoose-mongodb -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/pluginagentmarketplace/custom-plugin-nodejs/tree/HEAD/skills/mongoose-mongodb/SKILL.md

## When to use it
- connect MongoDB to a Node.js application
- define Mongoose schemas and data models
- run create, read, update, and delete operations
- load related documents through population
- build aggregation pipelines for database statistics

## Example prompts
- Connect this Node.js project to MongoDB with `mongoose` and the `MONGODB_URI` environment variable.
- Create a Mongoose user model with validation, an email index, and CRUD methods.
- Add a post-to-user relationship, then load the author with `populate`.

## Similar
- [mongodb-development](https://affpapa.org/en/nevibecode/skills/mongodb-development.md) — skill · 891 installs
- [mongodb](https://affpapa.org/en/nevibecode/skills/mongodb.md) — skill · 1700 installs
- [prisma-mongodb-upgrade](https://affpapa.org/en/nevibecode/skills/prisma-mongodb-upgrade.md) — skill · 370400 installs
- [mongodb-search-and-ai](https://affpapa.org/en/nevibecode/skills/mongodb-search-and-ai.md) — skill · 5800 installs
- [mongodb-connection](https://affpapa.org/en/nevibecode/skills/mongodb-connection.md) — skill · 5300 installs
- [mongodb-performance-advisor](https://affpapa.org/en/nevibecode/agents/mongodb-performance-advisor.md) — subagent · 223 installs

From the same set: [pluginagentmarketplace/custom-plugin-nodejs](https://affpapa.org/en/nevibecode/by/pluginagentmarketplace/custom-plugin-nodejs.md) — 3 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
