@feathersjs/mongodb adapter provides native MongoDB integration for Feathers services, supporting all MongoDB features including aggregation pipelines, GridFS, and transactions.
Installation
Configuration
Service Options
The MongoDB adapter accepts these options:Example Configuration
Querying
Basic Queries
The MongoDB adapter supports all standard Feathers query operators:MongoDB-Specific Options
Pass native MongoDB options throughparams.mongodb:
Aggregation Pipelines
Use MongoDB’s powerful aggregation framework with thepipeline parameter:
Data Manipulation
Create
Update
Patch
Remove
ObjectId Handling
The adapter automatically handles ObjectId conversion:Performance Optimization
Estimated Document Count
For large collections, use estimated count for better performance:Field Projection
Indexes
Create indexes on your collections:Type Safety
Full TypeScript support with generics:Error Handling
The adapter provides specific error handling:Next Steps
Knex Adapter
Learn about the SQL adapter
Common Patterns
Explore adapter patterns
Hooks
Add hooks to your services
Validation
Validate your data with schemas