feat(db-*): support sort in db.updateMany (#11768)

This adds support for `sort` in `payload.db.updateMany`.

## Example

```ts
const updatedDocs = await payload.db.updateMany({
  collection: 'posts',
  data: {
    title: 'updated',
  },
  limit: 5,
  sort: '-numberField', // <= new
  where: {
    id: {
      exists: true,
    },
  },
})
```
This commit is contained in:
Alessio Gravili
2025-03-19 10:47:58 -06:00
committed by GitHub
parent 68f2582b9a
commit e96d3c87e2
7 changed files with 225 additions and 35 deletions

View File

@@ -54,6 +54,7 @@ export type SupportedTimezones =
| 'Asia/Singapore'
| 'Asia/Tokyo'
| 'Asia/Seoul'
| 'Australia/Brisbane'
| 'Australia/Sydney'
| 'Pacific/Guam'
| 'Pacific/Noumea'
@@ -151,6 +152,7 @@ export interface UserAuthOperations {
export interface Post {
id: string;
title: string;
number?: number | null;
D1?: {
D2?: {
D3?: {
@@ -545,6 +547,7 @@ export interface PayloadMigration {
*/
export interface PostsSelect<T extends boolean = true> {
title?: T;
number?: T;
D1?:
| T
| {