TL;DR
Payload CMS v3.0.0-beta.127 brings significant improvements including PostgreSQL point field support, performance optimizations, and numerous bug fixes. This release enhances database functionality, fixes translation issues, and improves template handling. Note that there's a breaking change related to custom ID fields in MongoDB adapter.
Highlight of the Release
- Added full PostgreSQL point field support with geospatial query capabilities
- Performance improvements with reduced dependency size through json-schema-to-typescript upgrade
- Fixed MongoDB custom ID field handling (breaking change)
- Fixed login redirect issues
- Improved form state handling when editing via document drawer
Migration Guide
Breaking Change: MongoDB Custom ID Handling
When using custom ID fields with MongoDB adapter, there's an important change to be aware of:
If you have collection hooks for beforeValidate or beforeChange, data._id will no longer be assigned in these hooks as this now happens in the database adapter. Use data.id instead.
Before:
// In beforeValidate or beforeChange hooks
console.log(data._id) // This worked before
After:
// In beforeValidate or beforeChange hooks
console.log(data.id) // Use this instead
This change was made to ensure that if you set the id in hooks, the value gets properly sent to MongoDB.
Upgrade Recommendations
This beta release contains important bug fixes and features, particularly for PostgreSQL users and those working with custom ID fields in MongoDB.
For PostgreSQL users: Upgrading is highly recommended to gain access to the new point field support with geospatial querying capabilities.
For MongoDB users with custom ID fields: Be cautious when upgrading as there's a breaking change in how custom IDs are handled. Review your code for any instances where you access data._id in beforeValidate or beforeChange hooks and update them to use data.id instead.
For all users: The performance improvements and bug fixes make this a worthwhile upgrade, but as this is still a beta release, thorough testing in a non-production environment is advised before deploying to production.
Bug Fixes
MongoDB Fixes
- Fixed
totalDocs calculation with joins in MongoDB adapter - previously, using limit: 5 would incorrectly return totalDocs: 5
- Fixed migrations index file writing in MongoDB adapter
- Fixed custom ID field handling in MongoDB adapter
Form and UI Fixes
- Fixed incorrect form changed state after document drawer edits
- Fixed login redirect issues when route parameter was unintentionally overwritten
- Fixed
populate parameter not being passed to findOperation from the Local API
Template Fixes
- Fixed website template's missing paragraph feature that allows changing text from headings
- Improved template structure by using direct blocks props instead of drilling them through pages
Translation Improvements
- Corrected
emailOrPasswordIncorrect translation for Danish
- Improved Bulgarian translations for better accuracy, fixing translations that were incorrectly in Czech or Russian
- Fixed typos and improved wording in various translations
Documentation Fixes
- Fixed broken link on auth page email documentation
- Fixed typo in
onSuccess documentation (changed "if the task fails" to "if the task succeeds")
- Properly closed
<strong> tags in jobs queue documentation
- Fixed formatting in database transactions documentation
New Features
PostgreSQL Point Field Support
Full support for the point field type has been added to PostgreSQL and Vercel PostgreSQL adapters through the PostGIS extension. This implementation provides the same API as MongoDB, including support for near, within, and intersects operators for geospatial queries.
Additional adapter arguments have been exposed:
tablesFilter - for including specific tables, schemas, and extensions
extensions - list of extensions to create (e.g., ['vector', 'pg_search']), with postgis created automatically when point fields are used
Website Template Improvements
The website template now includes adminThumbnail for media, enhancing the admin interface experience when working with media assets.
Security Updates
No specific security fixes were mentioned in this release.
Performance Improvements
Dependency Optimization
The release includes a significant upgrade to json-schema-to-typescript and various other dependencies, which substantially reduces the package size and dependency count:
json-schema-to-typescript reduced from 14MB with 37 dependencies to 11MB with only 14 dependencies
- Special thanks to @benmccann for this contribution
Other Dependency Upgrades
Several other dependencies were upgraded for better performance:
- console-table-printer
- croner
- get-tsconfig
- jose
- pino-pretty
- ts-essentials
- tsx
These upgrades contribute to a leaner, more efficient package with fewer dependencies to manage.
Impact Summary
This release significantly enhances Payload CMS with PostgreSQL point field support, bringing geospatial querying capabilities on par with MongoDB. Performance has been improved through dependency optimizations, reducing package size and dependency count.
Several critical bugs have been fixed, including issues with MongoDB's totalDocs calculation, login redirects, form state management, and migration commands. Template improvements enhance the developer and content editor experience.
The breaking change to MongoDB custom ID handling is important to note for users with custom ID fields, requiring code updates to use data.id instead of data._id in certain hooks.
Overall, this release strengthens database support, improves performance, and enhances the user experience across multiple aspects of the CMS.
Full Release Notes
🚀 Features
- db-postgres: add point field support (#9078) (0a15388)
- templates: add adminThumbnail to media in website template (#9059) (015580a)
⚡ Performance
- upgrade json-schema-to-typescript and various other dependencies (#9076) (0cd83f0)
🐛 Bug Fixes
- migrateRefresh migrates without previously ran migrations (#9073) (e3172f1)
- handle custom id logic in mongodb adapter (#9069) (ee117bb)
- incorrect form changed state after doc drawer edit (#9025) (dc11104)
- login redirect missing route (#8990) (010ac2a)
populate with find operation (#9087) (721ae79)
- corrected translation emailOrPasswordIncorrect for Danish (da) (#9063) (57e535e)
- db-mongodb:
totalDocs with joins (#9056) (f67761f)
- db-mongodb: write migrations index file (#9071) (d20445b)
- docs: auth page email broken link (#9089) (1584c41)
- templates: use direct blocks props instead of drilling them out of pages (#9074) (b32c4de)
- templates: fix website template's missing paragraph feature allowing you to change text from headings (#9072) (1d5d303)
- translations: improves Bulgarian translations (#9031) (a6e7305)
⚠️ BREAKING CHANGES
-
handle custom id logic in mongodb adapter (#9069) (ee117bb)
When using custom ID fields, if you have any collection hooks for
beforeValidate, beforeChange then data._id will no longer be assigned
as this happens now in the database adapter. Use data.id instead.
🤝 Contributors