import { BulkBuilder } from '@onchaindb/sdk';
// Build batch of records
const builder = new BulkBuilder()
.collection('tweets')
.add({ message: 'Tweet 1', author: 'alice' })
.add({ message: 'Tweet 2', author: 'bob' })
.add({ message: 'Tweet 3', author: 'charlie' });
// Execute batch with progress tracking
const batch = client.batch();
const results = await batch.store(builder.build(), {
concurrency: 5,
waitForConfirmation: true,
onProgress: (completed, total) => {
console.log(`Progress: ${completed}/${total}`);
}
});
console.log(`Successfully stored ${results.length} records`);