Home

>

Tools

>

Payload CMS

>

Releases

>

Release 1.8.5

Payload CMS Release: Release 1.8.5

Tag Name: v1.8.5

Release Date: 6/3/2023

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 v1.8.5 introduces relationship validation enhancement

This minor release adds support for ObjectId values to pass through relationship validation, making it easier to work with MongoDB ObjectIds directly in your relationship fields. This improvement streamlines development workflows when dealing with relationships in Payload CMS.

Highlight of the Release

    • Support for MongoDB ObjectId values in relationship validation
    • Improved compatibility with MongoDB native data types
    • Streamlined development experience when working with relationships

Migration Guide

No migration is required for this release. The new ObjectId validation support is backward compatible with existing code that uses string IDs in relationship fields.

Upgrade Recommendations

This is a minor feature release that adds functionality without breaking changes. It's safe to upgrade from v1.8.4 to v1.8.5 without code modifications.

To upgrade:

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

If you're using ObjectIds directly in your code with relationship fields, you may now simplify your code by removing any string conversion steps that were previously required.

Bug Fixes

No specific bug fixes were included in this release.

New Features

ObjectId Support in Relationship Validation

Payload CMS now allows MongoDB ObjectId values to pass through relationship validation. This means you can directly use ObjectId instances when setting or updating relationship fields, without needing to convert them to strings first.

This enhancement is particularly useful when:

  • Working with MongoDB data directly in your code
  • Building integrations that need to reference documents by their ObjectId
  • Performing bulk operations where maintaining native ObjectId types is beneficial
// Example: Now valid in relationship fields
const objectId = new mongoose.Types.ObjectId('507f1f77bcf86cd799439011');
await payload.update({
  collection: 'posts',
  id: '123',
  data: {
    author: objectId, // Works directly with ObjectId
  },
});

Security Updates

No security fixes were included in this release.

Performance Improvements

No specific performance improvements were mentioned in this release.

Impact Summary

This release has a low impact on existing applications but provides a quality-of-life improvement for developers working with MongoDB relationships. The addition of ObjectId support in relationship validation makes the API more flexible and reduces the need for type conversions when working with MongoDB's native data types. This change is fully backward compatible and requires no migration steps.

Full Release Notes

1.8.5 (2023-06-03)

Features

  • allows objectid through relationship validation (42afa6b)

Statistics:

File Changed3
Line Additions34
Line Deletions5
Line Changes39
Total Commits4

User Affected:

  • Can now pass MongoDB ObjectId values directly through relationship validation
  • Experience improved flexibility when working with relationship fields
  • Reduced need for data transformation when dealing with MongoDB IDs

Contributors:

DanRibbensjmikrut