A Feathers database adapter for Mongoose ORM, allowing developers to integrate MongoDB with FeathersJS real-time APIs. Current stable version is 8.5.1, compatible with Feathers v5 (Dove), Mongoose >=6, and Node >=12. Key differentiators: built-in pagination, query modifiers, lean option for performance, discriminator support, and full integration with Feathers query syntax. Released under the FeathersJS ecosystem, it follows the Common database adapter API and provides TypeScript types.
npm install feathers-mongooseNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Sets up a Feathers service using Mongoose model with pagination and lean queries, then creates and retrieves messages.
Upgrade to @feathersjs/feathers@5 and @feathersjs/commons@5.
Use `import { service } from 'feathers-mongoose'` instead of `import service from 'feathers-mongoose'`.Ensure your Mongoose models use promises (e.g., `model.find().exec()`) rather than callbacks.
Call `toObject()` on the document before modifying, or set `lean: true` in service options.
Use Mongoose schema options `{ toJSON: { virtuals: true } }` and query with `.populate()` if needed.Set `id` option to match your schema's id field (e.g., `id: 'customId'`). Ensure MongoDB documents have `_id` set accordingly.
Ensure `mongoose.connect()` is called and awaited before using the service, or use `mongoose.connection.on('connected', ...)`.Use `const { service } = require('feathers-mongoose');` instead of `const service = require('feathers-mongoose');`.Ensure the ID is a valid MongoDB ObjectId string (24 hex chars) or use `null` for multi-update/remove.
Include all required fields in the data object, or set default values in Mongoose schema.