chpr-mongodb
Advanced tools
Comparing version 0.0.4 to 0.1.0
{ | ||
"name": "chpr-mongodb", | ||
"version": "0.0.4", | ||
"version": "0.1.0", | ||
"description": "MongoDB driver", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -12,2 +12,4 @@ const { EventEmitter } = require('events'); | ||
const NOT_SYSTEM_COLLECTION_REGEX = /^(?!system\.).*/; | ||
// https://github.com/mongodb/node-mongodb-native/blob/834a0e299a518d370e65b2bdb76994e97dbde63f/lib/server.js#L339 | ||
@@ -55,2 +57,16 @@ const MONGODB_CONNECTION_EVENTS = [ | ||
/** | ||
* Remove the info.uuid of a collection object | ||
* | ||
* @param collection | ||
* | ||
* @return {*} The filtered collection | ||
*/ | ||
static removeCollectionInfoUuid(collection) { | ||
if (collection && collection.info) { | ||
delete collection.info.uuid; | ||
} | ||
return collection; | ||
} | ||
/** | ||
* Connect the databases | ||
@@ -142,3 +158,3 @@ * | ||
*/ | ||
const collections = await db.listCollections({ name: { $regex: /^(?!system\.).*/ }}).toArray(); | ||
const collections = await db.listCollections({ name: { $regex: NOT_SYSTEM_COLLECTION_REGEX }}).toArray(); | ||
@@ -150,3 +166,3 @@ const collectionIndexesCursors = await Promise.all(collections | ||
name: databaseName, | ||
collections, | ||
collections: collections.map(MongoDbConnector.removeCollectionInfoUuid), | ||
collectionIndexes: collectionIndexesCursors.map(cursor => cursor.cursor.firstBatch) | ||
@@ -153,0 +169,0 @@ }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
62002
825