Home

>

Tools

>

Payload CMS

>

Releases

>

Release 1.9.4

Payload CMS Release: Release 1.9.4

Tag Name: v1.9.4

Release Date: 6/16/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.9.4 fixes a critical pagination bug

This patch release fixes an important bug where totalDocs was incorrectly returned as 1 when using pagination: false in query operations. Now, the correct document count is returned, ensuring accurate results when pagination is disabled. This is particularly important for developers who rely on document counts for their application logic while using non-paginated queries.

Highlight of the Release

    • Fixed critical bug where totalDocs was always returned as 1 when using pagination: false
    • Ensures accurate document counting in non-paginated queries
    • Improves reliability of applications that depend on document counts

Migration Guide

No migration is required for this patch release. The fix is automatically applied when upgrading to v1.9.4.

If you've implemented any workarounds in your code to handle the incorrect totalDocs count when using pagination: false, you can now safely remove those workarounds.

Upgrade Recommendations

This upgrade is recommended for all users who:

  • Use pagination: false in their queries
  • Rely on the totalDocs count in their application logic

The patch is small and focused, making it a low-risk upgrade from v1.9.3. There are no breaking changes or special upgrade steps required.

Bug Fixes

Fixed incorrect totalDocs count with disabled pagination

This release addresses a significant bug where queries with pagination: false would always return totalDocs: 1 regardless of the actual number of documents matching the query. The fix ensures that:

  • The totalDocs property now correctly reflects the total number of documents that match the query criteria
  • Applications that rely on document counts while using non-paginated queries will now receive accurate data
  • The fix applies to all collection types when using the payload.find() method with pagination: false

This bug was identified and fixed in PR #2791.

New Features

No new features were added in this patch release.

Security Updates

No security fixes were included in this release.

Performance Improvements

While this release primarily focuses on bug fixes, the correction of the totalDocs count may indirectly improve performance for applications that were implementing workarounds for the incorrect counting behavior. By providing accurate counts directly, applications no longer need to perform additional queries to determine the correct document count.

Impact Summary

This patch release fixes a specific but important bug in Payload CMS's query functionality. The impact is primarily on data accuracy rather than functionality or performance.

Before this fix, any query using pagination: false would incorrectly report totalDocs as 1, regardless of how many documents actually matched the query. This could lead to incorrect application behavior if your code relied on this count for pagination controls, data processing logic, or reporting.

The fix ensures that totalDocs accurately reflects the actual number of documents matching your query criteria, even when pagination is disabled. This improves the reliability of applications built with Payload CMS, especially those that need accurate document counts while retrieving all matching documents in a single query.

The change is backward compatible and requires no code changes in your application.

Full Release Notes

1.9.4 (2023-06-16)

Bug Fixes

  • incorrectly return totalDocs=1 instead of the correct count when pagination=false (2e73938)

Statistics:

File Changed4
Line Additions24
Line Deletions2
Line Changes26
Total Commits4

User Affected:

  • Can now rely on accurate `totalDocs` count when using `pagination: false` in queries
  • No longer need to implement workarounds for incorrect document counts
  • Applications that depend on accurate document counts will now function correctly

Contributors:

richadrjmikrut