mongoose
Installation
SKILL.md
Mongoose Skill (2025-2026 Edition)
This skill provides modern guidelines for using Mongoose with MongoDB, focusing on Mongoose 8.x/9.x, strict TypeScript integration, and performance optimizations relevant to the 2025 ecosystem.
π Key Trends & Features (2025/2026)
- TypeScript-First: Mongoose 8+ has superior built-in type inference.
@types/mongooseis obsolete. - Performance: Mongoose 9 introduces architectural changes for lower overhead. Native vector search support is now standard for AI features.
- Modern JavaScript: Full support for
async/awaititerators and native Promises.
π TypeScript Integration (The Strict Way)
Do NOT extend LengthyDocument or standard Document. Use a plain interface and let Mongoose infer the rest.
1. Define the Interface (Raw Data)
Define what your data looks like in plain JavaScript objects.
import { Types } from 'mongoose';