feat: add count operation to collections (#5930)

This commit is contained in:
Ritsu
2024-04-20 21:45:44 +03:00
committed by GitHub
parent d987e5628a
commit d5cbbc472d
25 changed files with 538 additions and 9 deletions

View File

@@ -164,6 +164,22 @@ const result = await payload.findByID({
})
```
#### Count
```js
// Result will be an object with:
// {
// totalDocs: 10, // count of the documents satisfies query
// }
const result = await payload.count({
collection: 'posts', // required
locale: 'en',
where: {}, // pass a `where` query here
user: dummyUser,
overrideAccess: false,
})
```
#### Update by ID
```js