mongochangestream
Advanced tools
Comparing version 0.6.0 to 0.7.0
@@ -0,1 +1,5 @@ | ||
# 0.7.0 | ||
* `omit` option for excluding undesired fields. | ||
# 0.6.0 | ||
@@ -2,0 +6,0 @@ |
@@ -12,2 +12,3 @@ "use strict"; | ||
const prom_utils_1 = require("prom-utils"); | ||
const util_js_1 = require("./util.js"); | ||
const debug = (0, debug_1.default)('mongodbChangeStream'); | ||
@@ -43,2 +44,3 @@ const keyPrefix = 'mongodbChangeStream'; | ||
const sortField = options?.sortField || exports.defaultSortField; | ||
const omit = options?.omit; | ||
// Redis keys | ||
@@ -73,3 +75,3 @@ const { scanCompletedKey, lastScanIdKey } = getKeys(collection); | ||
? { [sortField.field]: { $gt: sortField.deserialize(lastId) } } | ||
: {}) | ||
: {}, omit ? { projection: (0, util_js_1.setDefaults)(omit, 0) } : {}) | ||
.sort({ [sortField.field]: 1 }); | ||
@@ -76,0 +78,0 @@ const ns = { db: collection.dbName, coll: collection.collectionName }; |
@@ -10,2 +10,3 @@ import { ChangeStreamDocument, ChangeStreamInsertDocument } from 'mongodb'; | ||
}; | ||
omit?: string[]; | ||
} |
{ | ||
"name": "mongochangestream", | ||
"version": "0.6.0", | ||
"version": "0.7.0", | ||
"description": "Sync MongoDB collections via change streams into any database.", | ||
@@ -5,0 +5,0 @@ "author": "GovSpend", |
@@ -8,2 +8,3 @@ import _ from 'lodash/fp.js' | ||
import { batchQueue, QueueOptions } from 'prom-utils' | ||
import { setDefaults } from './util.js' | ||
@@ -50,2 +51,3 @@ const debug = _debug('mongodbChangeStream') | ||
const sortField = options?.sortField || defaultSortField | ||
const omit = options?.omit | ||
// Redis keys | ||
@@ -81,3 +83,4 @@ const { scanCompletedKey, lastScanIdKey } = getKeys(collection) | ||
? { [sortField.field]: { $gt: sortField.deserialize(lastId) } } | ||
: {} | ||
: {}, | ||
omit ? { projection: setDefaults(omit, 0) } : {} | ||
) | ||
@@ -84,0 +87,0 @@ .sort({ [sortField.field]: 1 }) |
@@ -15,2 +15,3 @@ import { ChangeStreamDocument, ChangeStreamInsertDocument } from 'mongodb' | ||
} | ||
omit?: string[] | ||
} |
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
21515
21
440