Skip to content

Commit 79db997

Browse files
committed
docs: add batching caveat to updateMany JSDoc
Address review feedback — warn that the query should exclude already-updated records to avoid re-processing when looping through batches of 500+. Made-with: Cursor
1 parent b29edf5 commit 79db997

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/modules/entities.types.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,9 @@ export interface EntityHandler<T = any> {
405405
*
406406
* Results are batched in groups of up to 500. When `has_more` is `true`
407407
* in the response, call `updateMany` again with the same query to update
408-
* the next batch.
408+
* the next batch. Make sure the query excludes already-updated records
409+
* so you don't re-process the same entities on each iteration. For
410+
* example, filter by `status: 'pending'` when setting status to `'processed'`.
409411
*
410412
* To update a single record by ID, use {@linkcode update | update()} instead. To update
411413
* multiple specific records with different data each, use {@linkcode bulkUpdate | bulkUpdate()}.
@@ -457,7 +459,9 @@ export interface EntityHandler<T = any> {
457459
* @example
458460
* ```typescript
459461
* // Batched updates
460-
* // Process all pending items in batches of 500
462+
* // Process all pending items in batches of 500.
463+
* // The query filters by 'pending', so updated records (now 'processed')
464+
* // are automatically excluded from the next batch.
461465
* let hasMore = true;
462466
* let totalUpdated = 0;
463467
* while (hasMore) {

0 commit comments

Comments
 (0)