Home

>

Tools

>

Payload CMS

>

Releases

>

Release v2.7.0

Payload CMS Release: Release v2.7.0

Tag Name: v2.7.0

Release Date: 1/9/2024

Payload CMS LogoPayload CMS

Payload CMS is a modern, self-hosted headless content management system built with TypeScript, Node.js, and MongoDB. It's designed specifically for developers who want full control over their content management system while maintaining a powerful admin interface for content editors.

TL;DR

Payload CMS v2.7.0 introduces significant improvements to transaction support in migrations, adds hasMany property for text fields, and enhances the SEO plugin with i18n support. This release also fixes numerous database-related issues, particularly for PostgreSQL and MongoDB, improves nested document handling, and addresses various UI and validation bugs. The update focuses on database reliability, field customization, and plugin enhancements.

Highlight of the Release

    • Added hasMany property for text fields, enabling multi-value text inputs
    • Improved transaction support in migrations by passing request context
    • Added internationalization (i18n) support to the SEO plugin
    • Fixed PostgreSQL JSON field querying with exists operator
    • Fixed issues with custom IDs in versions and relationships
    • Improved nested documents plugin with fixes for breadcrumbs and parent fields

Migration Guide

hasMany Text Fields

If you're upgrading to v2.7.0 and want to use the new hasMany property for text fields, you'll need to update your field configurations:

{
  name: 'tags',
  type: 'text',
  hasMany: true
}

This will transform a regular text field into one that accepts multiple values.

Transaction Support in Migrations

If you have custom migrations that utilize transactions, they will now receive the request context. Update your migration functions to accept and utilize the req parameter if needed:

// Before
async up() {
  // migration logic
}

// After
async up(req) {
  // migration logic with access to req
}

SEO Plugin Internationalization

If you're using the SEO plugin and want to leverage the new i18n support, ensure your localization configuration is properly set up in your Payload config. The SEO plugin will automatically use your configured locales.

Upgrade Recommendations

This release contains important bug fixes and new features that improve database reliability and field functionality. We recommend all users upgrade to v2.7.0, especially if you:

  • Use PostgreSQL as your database (multiple critical fixes)
  • Work with nested documents (several plugin fixes)
  • Need multi-value text fields (new hasMany feature)
  • Require internationalization for SEO content
  • Use custom migrations with transactions

The upgrade should be straightforward for most users as there are no breaking changes reported. Update your Payload dependency to v2.7.0 using your package manager:

npm install [email protected]
# or
yarn add [email protected]

After upgrading, test your application thoroughly, especially if you rely on PostgreSQL JSON field queries, nested documents, or custom ID handling, as these areas received significant fixes.

Bug Fixes

Database Fixes

  • PostgreSQL:

    • Fixed incorrect results when querying JSON fields using the exists operator
    • Fixed issues with querying JSON properties
    • Resolved validation problems that prevented using group fields within blocks
    • Fixed "migrate down" operations to properly limit to the latest batch
    • Fixed relationship fields with number-based IDs showing "untitled ID: x"
  • MongoDB:

    • Fixed migration errors when calling beginTransaction with transactionOptions set to false
    • Improved query planning for collections that were ignoring indexes

Plugin Fixes

  • Nested Documents Plugin:

    • Fixed custom overrides of breadcrumb and parent fields
    • Fixed breadcrumbsFieldSlug usage in resaveSelfAfterCreate hook
    • Fixed parent filterOptions errors when specifying breadcrumbsFieldSlug
    • Fixed issues with children wrongly publishing draft data
  • Form Builder Plugin:

    • Fixed slate serializer to properly replace curly braces in links

UI and Validation Fixes

  • Fixed sidebar fields not being properly disabled by access permissions
  • Fixed JSON fields to allow saving empty values and properly reflect value changes
  • Fixed non-boolean condition results causing infinite looping
  • Fixed user unlock condition that always passed due to seconds conversion
  • Fixed row overflow in the admin UI
  • Added ObjectID validation to isValidID for fields of type text
  • Fixed custom IDs in versions

New Features

Text Fields with hasMany Support

Text fields now support a hasMany property, allowing users to create and manage multiple text values within a single field. This feature is particularly useful for tags, keywords, or any scenario where multiple text entries are needed.

Enhanced Transaction Support in Migrations

Migrations now receive the request context (req), significantly improving transaction support across both MongoDB and PostgreSQL databases. This enhancement allows for more reliable and context-aware database migrations.

SEO Plugin Internationalization

The SEO plugin now supports internationalization (i18n), making it possible to manage SEO content in multiple languages. This includes translations and localized content management for SEO fields.

Document Info in Actions Provider

Actions now have access to document information, enabling more context-aware custom actions in the admin UI.

Security Updates

No specific security fixes were mentioned in this release. However, the fix for ObjectID validation in isValidID for fields of type text does improve input validation, which is generally beneficial for security by preventing potential injection or malformed data issues.

Performance Improvements

MongoDB Query Performance

Improved MongoDB query performance by fixing an issue where the query planner for collections was ignoring indexes. This enhancement ensures that queries utilize available indexes properly, resulting in faster query execution, especially for large collections.

Transaction Handling

Enhanced transaction support across both MongoDB and PostgreSQL databases by passing the request context to migrations. This improvement allows for more efficient and reliable transaction handling during database operations.

UI Rendering Optimizations

Fixed an issue with row overflow that was causing unnecessary re-renders and potential performance degradation in the admin UI.

Impact Summary

Payload CMS v2.7.0 delivers substantial improvements to database reliability and field functionality. The addition of hasMany support for text fields provides developers with a more flexible way to handle multiple text values, while the enhanced transaction support in migrations improves database operation reliability.

PostgreSQL users will benefit significantly from this release, as it addresses several critical issues related to JSON field querying, custom IDs, and migration operations. MongoDB users also gain performance improvements through better index utilization.

The internationalization support added to the SEO plugin is particularly valuable for teams working with multilingual content, allowing for more comprehensive SEO management across different languages.

Content editors will appreciate the fixes to nested documents, breadcrumbs, and parent fields, which improve the content organization experience. The fixed sidebar permissions ensure that access controls are properly respected in the admin UI.

Overall, this release enhances Payload's stability, performance, and feature set without introducing breaking changes, making it a recommended upgrade for all users.

Full Release Notes

2.7.0 (2024-01-09)

Features

  • db-mongodb: improve transaction support by passing req to migrations (682eca2)
  • db-postgres: improve transaction support by passing req to migrations (555d027)
  • hasMany property for text fields (#4605) (f43cf18)
  • improve transaction support by passing req to migrations (1d14d9f)
  • plugin-seo: add i18n (#4665) (3027a03)

Bug Fixes

  • adds objectID validation to isValidID if of type text (#4689) (d419275)
  • allow json field to be saved empty and reflect value changes (#4687) (0fb3a9c)
  • custom ids in versions (#4680) (5d15955)
  • custom overrides of breadcrumb and parent fields (7db58b4)
  • db-mongodb: migration error calling beginTransaction with transactionOptions false (21b9453)
  • db-mongodb: querying plan for collections ignoring indexes (#4655) (63bc4ca)
  • db-postgres: incorrect results querying json field using exists operator (9d9ac0e)
  • db-postgres: migrate down only runs latest batch size (6acfae8)
  • db-postgres: query on json properties (ec4d2f9)
  • db-postgres: validation prevents group fields in blocks (#4699) (cab6bab)
  • non-boolean condition result causes infinite looping (#4579) (a3e7816)
  • plugin-form-builder: slate serializer should replace curly braces in links (#4703) (28a3012)
  • plugin-nested-docs: breadcrumbsFieldSlug used in resaveSelfAfterCreate hook (a5a91c0)
  • plugin-nested-docs: children wrongly publishing draft data (#4692) (5539942)
  • plugin-nested-docs: custom parent field slug (635e7c2)
  • plugin-nested-docs: parent filterOptions errors when specifying breadcrumbsFieldSlug (c4a4678)
  • prevents row overflow (#4704) (9828772)
  • relations with number based ids (postgres) show untitled ID: x (1b91408)
  • sidebar fields not disabled by access permissions (#4682) (85e38b7)
  • unlock user condition always passes due to seconds conversion (#4610) (d543665)

Statistics:

File Changed142
Line Additions2,588
Line Deletions840
Line Changes3,428
Total Commits53

User Affected:

  • Benefit from improved transaction support in migrations with request context access
  • Can now use hasMany property for text fields, enabling multi-value text inputs
  • Fixed PostgreSQL and MongoDB database issues improve reliability of applications
  • Better handling of custom IDs in versions and relationships

Contributors:

DanRibbensdenolfepaulpopusAlessioGrGeorgeHulpoiGokulsckjessrynkarPatrikKozakDasMergodependabot[bot]jmikrut