Documentation Index Fetch the complete documentation index at: https://mintlify.com/feathersjs/feathers/llms.txt
Use this file to discover all available pages before exploring further.
Feathers provides a powerful adapter system that allows you to connect your services to different databases using a consistent API. All adapters share common patterns and querying capabilities while supporting database-specific features.
Available Adapters
Feathers supports multiple database adapters out of the box:
MongoDB Native MongoDB adapter for document-based storage
Knex (SQL) SQL adapter supporting PostgreSQL, MySQL, SQLite, and more
Memory In-memory storage for testing and prototyping
Common Features
All Feathers database adapters share these core capabilities:
Standard Service Methods
Every adapter implements the standard Feathers service interface:
interface ServiceMethods {
find ( params ?: Params ) : Promise < Paginated < Result > | Result []>
get ( id : Id , params ?: Params ) : Promise < Result >
create ( data : Data | Data [], params ?: Params ) : Promise < Result | Result []>
update ( id : Id , data : Data , params ?: Params ) : Promise < Result >
patch ( id : Id | null , data : PatchData , params ?: Params ) : Promise < Result | Result []>
remove ( id : Id | null , params ?: Params ) : Promise < Result | Result []>
}
Query Syntax
All adapters support a common query syntax for filtering, sorting, and pagination:
Filtering
Sorting
Pagination
Selection
// Find users with age greater than 18
await app . service ( 'users' ). find ({
query: {
age: { $gt: 18 }
}
})
// Find users with specific names
await app . service ( 'users' ). find ({
query: {
name: { $in: [ 'Alice' , 'Bob' ] }
}
})
Supported Query Operators
Operator Description Example $eqEqual (implicit) { age: 25 }$neNot equal { status: { $ne: 'deleted' } }$ltLess than { age: { $lt: 30 } }$lteLess than or equal { age: { $lte: 30 } }$gtGreater than { age: { $gt: 18 } }$gteGreater than or equal { age: { $gte: 18 } }$inIn array { role: { $in: ['admin', 'user'] } }$ninNot in array { role: { $nin: ['guest'] } }$orLogical OR { $or: [{ age: { $lt: 18 } }, { age: { $gt: 65 } }] }$andLogical AND { $and: [{ age: { $gte: 18 } }, { verified: true }] }
Enable pagination in your service options:
const service = new MongoDBService ({
Model: collection ,
paginate: {
default: 10 , // Default page size
max: 50 // Maximum page size
}
})
Paginated responses include:
interface Paginated < T > {
total : number // Total count of matching records
limit : number // Page size
skip : number // Number of records skipped
data : T [] // Array of results
}
Adapter Options
All adapters support these common options:
interface AdapterServiceOptions {
id : string // Primary key field name (default: 'id')
events : string [] // Custom events to emit
paginate ?: PaginationOptions // Pagination configuration
multi ?: boolean | string [] // Allow multi updates/deletes
filters ?: FilterSettings // Custom query filters
operators ?: string [] // Custom query operators
}
Multi Operations
By default, patch and remove without an ID will throw an error. Enable multi operations:
const service = new MongoDBService ({
Model: collection ,
multi: true // Allow all multi operations
})
// Or enable for specific methods only
const service = new MongoDBService ({
Model: collection ,
multi: [ 'patch' , 'remove' ]
})
// Now you can patch/remove multiple records
await service . patch ( null , { status: 'archived' }, {
query: { active: false }
})
Internal Methods
Adapters provide internal _method versions that bypass hooks and validation:
// These skip hooks and sanitization
await service . _find ( params )
await service . _get ( id , params )
await service . _create ( data , params )
await service . _update ( id , data , params )
await service . _patch ( id , data , params )
await service . _remove ( id , params )
Internal methods should only be used within hooks or when you need to bypass the normal service flow. They don’t run hooks or emit events.
Type Safety
All adapters support full TypeScript typing:
interface User {
_id : ObjectId
name : string
email : string
age : number
}
interface UserData {
name : string
email : string
age : number
}
interface UserParams extends Params {
user ?: User
}
class UserService extends MongoDBService < User , UserData , UserParams > {
// Fully typed service methods
}
Next Steps
MongoDB Adapter Learn how to use the MongoDB adapter
Knex Adapter Connect to SQL databases with Knex
Common Patterns Explore adapter patterns and best practices