mongochangestream
Advanced tools
Comparing version 0.4.0 to 0.5.0
@@ -0,1 +1,5 @@ | ||
# 0.5.0 | ||
* Pass `QueueOptions` to `runInitialScan`. | ||
# 0.4.0 | ||
@@ -2,0 +6,0 @@ |
import { Collection } from 'mongodb'; | ||
import { ProcessRecord, ProcessRecords } from './types.js'; | ||
import type { default as Redis } from 'ioredis'; | ||
import { QueueOptions } from 'prom-utils'; | ||
export declare const initSync: (redis: Redis) => { | ||
runInitialScan: (collection: Collection, processRecords: ProcessRecords, batchSize?: number) => Promise<void>; | ||
runInitialScan: (collection: Collection, processRecords: ProcessRecords, options?: QueueOptions) => Promise<void>; | ||
processChangeStream: (collection: Collection, processRecord: ProcessRecord, pipeline?: Document[]) => Promise<void>; | ||
reset: (collection: Collection) => Promise<void>; | ||
}; |
@@ -31,5 +31,5 @@ "use strict"; | ||
/** | ||
* Run initial collection scan. | ||
* Run initial collection scan. `options.batchSize` defaults to 500. | ||
*/ | ||
const runInitialScan = async (collection, processRecords, batchSize = 100) => { | ||
const runInitialScan = async (collection, processRecords, options) => { | ||
debug('Running initial scan'); | ||
@@ -56,3 +56,3 @@ // Redis keys | ||
// Create queue | ||
const queue = (0, prom_utils_1.batchQueue)(_processRecords, { batchSize }); | ||
const queue = (0, prom_utils_1.batchQueue)(_processRecords, options); | ||
// Query collection | ||
@@ -59,0 +59,0 @@ const cursor = collection |
{ | ||
"name": "mongochangestream", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "Sync MongoDB collections via change streams into any database.", | ||
@@ -5,0 +5,0 @@ "author": "GovSpend", |
@@ -57,3 +57,3 @@ # Mongo Change Stream | ||
processRecord: ProcessRecord, | ||
batchSize = 100 | ||
options?: QueueOptions | ||
): Promise<void> => ... | ||
@@ -60,0 +60,0 @@ |
@@ -6,3 +6,3 @@ import { ChangeStreamInsertDocument, Collection, ObjectId } from 'mongodb' | ||
import type { default as Redis } from 'ioredis' | ||
import { batchQueue } from 'prom-utils' | ||
import { batchQueue, QueueOptions } from 'prom-utils' | ||
@@ -34,3 +34,3 @@ const debug = _debug('mongodbChangeStream') | ||
/** | ||
* Run initial collection scan. | ||
* Run initial collection scan. `options.batchSize` defaults to 500. | ||
*/ | ||
@@ -40,3 +40,3 @@ const runInitialScan = async ( | ||
processRecords: ProcessRecords, | ||
batchSize = 100 | ||
options?: QueueOptions | ||
) => { | ||
@@ -64,3 +64,3 @@ debug('Running initial scan') | ||
// Create queue | ||
const queue = batchQueue(_processRecords, { batchSize }) | ||
const queue = batchQueue(_processRecords, options) | ||
// Query collection | ||
@@ -67,0 +67,0 @@ const cursor = collection |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19064
368