Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

- added: Accept a chunk size for rolling database streaming queries.
- fixed: Use the `watchCluster` to filter rolling databases, not the default pool cluster.

## 0.2.22 (2025-07-03)

- fixed: Correctly ignore archived rolling databases.
Expand Down
11 changes: 7 additions & 4 deletions src/couchdb/rolling-database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -408,11 +408,12 @@ export function makeRollingDatabase<T>(
connection: ServerScope,
design: string,
view: string,
opts: RollingViewParams
opts: RollingViewParams & { chunkSize?: number }
): AsyncIterableIterator<CouchDoc<T>> {
const {
afterDate,
partition,
chunkSize,
// Native CouchDB options:
...rest
} = opts
Expand All @@ -426,7 +427,7 @@ export function makeRollingDatabase<T>(
: db.partitionedView(partition, design, view, allParams))
return rows
},
{ afterDate }
{ chunkSize, afterDate }
)
}

Expand All @@ -436,7 +437,9 @@ export function makeRollingDatabase<T>(
if (database.startDate.valueOf() > date.valueOf()) continue
return database.name
}
throw new Error(`No rolling database exists for ${date.toISOString()}`)
throw new Error(
`No rolling database exists for ${name} at ${date.toISOString()}`
)
}

async function insert(
Expand Down Expand Up @@ -548,7 +551,7 @@ export function makeRollingDatabase<T>(
}
const { exists } = clusterHasDatabase(
replicatorSetup?.doc,
pool.defaultName,
watchCluster,
setup
)
if (exists) {
Expand Down
Loading