Home

>

Tools

>

Payload CMS

>

Releases

>

Release 0.7.2

Payload CMS Release: Release 0.7.2

Tag Name: v0.7.2

Release Date: 6/22/2021

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

PayloadCMS v0.7.2 introduces a significant enhancement with the new maxDepth property for relationship and upload fields, allowing developers to control the depth of populated relationships. This release also fixes critical issues with query string number parsing, relationship population, and properly respecting maxDepth: 0 settings. These improvements enhance data handling and query capabilities while giving developers more control over API responses.

Highlight of the Release

    • New maxDepth property for relationship and upload fields to control population depth
    • Fixed query string number parsing for where clauses
    • Improved handling of MongoDB ObjectIDs during relationship population
    • Added proper support for maxDepth: 0 setting

Migration Guide

No migration is required for this release. The new maxDepth property is optional and can be added to existing relationship and upload field configurations as needed.

If you've been experiencing issues with query string number parsing, relationship population, or ObjectID handling, upgrading to v0.7.2 should resolve these problems without requiring code changes.

Upgrade Recommendations

This release is recommended for all PayloadCMS users, especially those working with complex relationship structures or experiencing issues with query parameter handling.

The upgrade should be straightforward with no breaking changes. Simply update your package.json dependency:

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

After upgrading, you can start using the new maxDepth property in your relationship and upload field configurations to optimize API responses.

Bug Fixes

Fixed Query String Number Parsing

Previously, numeric values passed through query strings weren't being properly parsed for use in where clauses. This could cause unexpected behavior when filtering collections based on numeric values. This release fixes the issue by ensuring proper parsing of numeric query parameters.

Proper Support for MaxDepth: 0

The release fixes an issue where setting maxDepth: 0 wasn't being properly respected. Now, when maxDepth: 0 is specified, the system will correctly avoid populating any relationships.

Safe ObjectID Stringification

Fixed an issue with MongoDB ObjectIDs not being safely stringified during relationship population. This improves reliability when working with MongoDB references and prevents potential errors when handling ObjectID values.

New Features

MaxDepth Property for Relationship and Upload Fields

PayloadCMS now supports a new maxDepth property for relationship and upload fields. This feature gives developers precise control over how deeply nested relationships are populated in API responses.

When defining relationship or upload fields in your collection config, you can now specify:

{
  name: 'relatedPosts',
  type: 'relationship',
  relationTo: 'posts',
  maxDepth: 2 // Only populate relationships 2 levels deep
}

This is particularly useful for:

  • Preventing excessive database queries with deeply nested relationships
  • Controlling API response size
  • Avoiding circular reference issues in complex data models

The maxDepth property accepts numeric values (including 0) to define the population depth limit.

Security Updates

No specific security fixes were included in this release.

Performance Improvements

The new maxDepth property provides performance benefits by allowing developers to limit the depth of relationship population. This can significantly reduce database load and response times for complex data structures with many nested relationships.

By setting appropriate maxDepth values, API responses can be optimized to include only the necessary related data, reducing both query complexity and response payload size.

Impact Summary

PayloadCMS v0.7.2 enhances developer control over API responses through the new maxDepth property for relationship and upload fields. This feature allows for fine-tuning of relationship population depth, which can significantly improve performance and prevent issues with circular references.

The bug fixes for query string number parsing, maxDepth: 0 support, and ObjectID stringification address important issues that could affect data retrieval and filtering operations. These improvements make the API more reliable and predictable.

Overall, this release focuses on giving developers more control over relationship population while fixing critical issues that affect everyday use of the CMS. The changes are backward compatible and require no migration effort.

Full Release Notes

0.7.2 (2021-06-22)

Bug Fixes

  • parses incoming numbers through query string for use in where clauses (4933b34)
  • respect maxDepth 0 (95c1650)
  • safely stringifies ObjectIDs while populating relationships (d6bc6f9)

Features

  • adds maxDepth to relationships and upload fields (880dabd)

Statistics:

File Changed11
Line Additions66
Line Deletions7
Line Changes73
Total Commits8

User Affected:

  • Can now control relationship population depth with the new `maxDepth` property
  • Will experience more reliable query string parameter handling for numeric values
  • Will see improved handling of MongoDB ObjectIDs during relationship population

Contributors:

DanRibbensjmikrut