payload
payload copied to clipboard
feat: collections can use custom database operations
Description
Adds option to override default database operations for a collection
import { CollectionConfig } from 'payload/types';
const Collection: CollectionConfig = {
slug: 'example-collection',
// Database operations for this collection
db: {
create: () => {},
deleteMany: () => {},
deleteOne: () => {},
find: () => {},
findOne: () => {},
updateOne: () => {}
},
fields: [
{
name: 'someField',
type: 'text',
},
],
}
export default Collection;
Type of change
- [x] New feature (non-breaking change which adds functionality)
- [ ] This change requires a documentation update
Checklist:
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] Existing test suite passes locally with my changes
- [ ] I have made corresponding changes to the documentation