Use this file to discover all available pages before exploring further.
Use batch operations for efficient bulk data processing. OnDB’s store() method accepts arrays of records, and for large-scale imports you can partition data into chunks.
When processing large datasets across multiple OnDB client instances (e.g., multiple workers, microservices, or serverless functions), you need coordination for global progress tracking and deduplication.
Create a unique hash index on a natural key or a dedicated import_id field to prevent duplicate records when multiple workers process overlapping data:
Use a shared coordination collection to track progress across all workers. Each worker writes its progress, and any client can query the aggregate state:
// Each worker reports progress to a shared collectionasync function reportProgress( workerId: string, completed: number, total: number) { await client.store({ collection: 'import_progress', data: [{ worker_id: workerId, job_id: 'import-2026-03-16', completed, total, updated_at: new Date().toISOString(), }] });}// Query global progress from any clientasync function getGlobalProgress(jobId: string) { const progress = await client.queryBuilder() .collection('import_progress') .whereField('job_id').equals(jobId) .execute(); const workers = progress.records; const globalCompleted = workers.reduce((sum, w) => sum + w.completed, 0); const globalTotal = workers.reduce((sum, w) => sum + w.total, 0); const percent = Math.round((globalCompleted / globalTotal) * 100); console.log(`Global progress: ${percent}% (${globalCompleted}/${globalTotal})`); console.log(`Active workers: ${workers.length}`); return { globalCompleted, globalTotal, percent, workers };}