mongochangestream
Advanced tools
Comparing version 0.10.0 to 0.11.0
@@ -0,1 +1,5 @@ | ||
# 0.11.0 | ||
* Prepend `pipeline` with omit pipeline if `omit` is passed to `initSync`. | ||
# 0.10.0 | ||
@@ -2,0 +6,0 @@ |
@@ -39,3 +39,3 @@ "use strict"; | ||
const omit = options?.omit; | ||
const defaultPipeline = omit ? (0, util_js_1.generatePipelineFromOmit)(omit) : []; | ||
const omitPipeline = omit ? (0, util_js_1.generatePipelineFromOmit)(omit) : []; | ||
/** | ||
@@ -99,4 +99,6 @@ * Run initial collection scan. `options.batchSize` defaults to 500. | ||
* Process MongoDB change stream for the given collection. | ||
* If omit is passed to `initSync` a pipeline stage that removes | ||
* those fields will be prepended to the `pipeline` argument. | ||
*/ | ||
const processChangeStream = async (collection, processRecord, pipeline) => { | ||
const processChangeStream = async (collection, processRecord, pipeline = []) => { | ||
// Redis keys | ||
@@ -111,3 +113,3 @@ const { changeStreamTokenKey } = (0, exports.getKeys)(collection); | ||
// Get the change stream as an async iterator | ||
const changeStream = (0, changeStreamToIterator_js_1.default)(collection, pipeline || defaultPipeline, options); | ||
const changeStream = (0, changeStreamToIterator_js_1.default)(collection, [...omitPipeline, ...pipeline], options); | ||
// Consume the events | ||
@@ -114,0 +116,0 @@ for await (const event of changeStream) { |
{ | ||
"name": "mongochangestream", | ||
"version": "0.10.0", | ||
"version": "0.11.0", | ||
"description": "Sync MongoDB collections via change streams into any database.", | ||
@@ -5,0 +5,0 @@ "author": "GovSpend", |
@@ -46,3 +46,3 @@ import _ from 'lodash/fp.js' | ||
const omit = options?.omit | ||
const defaultPipeline = omit ? generatePipelineFromOmit(omit) : [] | ||
const omitPipeline = omit ? generatePipelineFromOmit(omit) : [] | ||
/** | ||
@@ -115,2 +115,4 @@ * Run initial collection scan. `options.batchSize` defaults to 500. | ||
* Process MongoDB change stream for the given collection. | ||
* If omit is passed to `initSync` a pipeline stage that removes | ||
* those fields will be prepended to the `pipeline` argument. | ||
*/ | ||
@@ -120,3 +122,3 @@ const processChangeStream = async ( | ||
processRecord: ProcessRecord, | ||
pipeline?: Document[] | ||
pipeline: Document[] = [] | ||
) => { | ||
@@ -134,3 +136,3 @@ // Redis keys | ||
collection, | ||
pipeline || defaultPipeline, | ||
[...omitPipeline, ...pipeline], | ||
options | ||
@@ -137,0 +139,0 @@ ) |
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
24435
510