@resolveio/server-lib 20.7.14 → 20.7.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/managers/mongo.manager.ts"],"names":["async_1","require","NodeCache","os_1","simpl_schema_1","user_collection_1","resolveio_server_app_1","common_1","monitor_manager_1","crypto","scmp","numCPUs","cpus","length","v8","AsyncLocalStorage","asyncLocalStorage","MongoManager","this","_collections","_cacheMap","_operationInProgress","Map","_heapSize","getHeapStatistics","_serverCollections","_isWorkersEnabled","_isWorkerInstance","create","mongoManager","initialize","_a","sent","prototype","_nodeCache","stdTTL","checkperiod","process","env","IS_WORKERS_ENABLED","IS_WORKER_INSTANCE","setCacheLimit","setupChangeStream","ResolveIOServer","getMainDB","listCollections","toArray","collections","oneTimeTransaction","fn","_this","run","__awaiter","session","getMongoConnection","startSession","getStore","withTransaction","result_1","endSession","store","getSession","_heapLimit","getServerCollections","registerCollection","collection","collectionOptions","timeseries","timeField","some","a","name","collectionName","type","dropCollection","createCollection","push","find","delay","ms","Promise","resolve","setTimeout","filter","options","safeOptions","__rest","cacheKey","generateCacheKey","undefined","result","getFromCache","getMainServer","getSubscriptionManager","getEnableDebug","console","log","Date","has","get","promise","operation","executeFind","set","invalidatedDuringExecution","finally","delete","_b","monitor","MonitorMongo","JSON","stringify","message","concat","err_1","finish","addToCache","findOne","executeFindOne","err_2","aggregate","pipeline","__spreadArray","__read","flatMap","stage","$lookup","from","executeAggregate","err_3","countDocuments","executeCountDocuments","err_4","functionName","args","keyString","createHash","update","digest","cachedData","parse","dateReviver","del","data","getBinarySize","includes","endsWith","startsWith","nodeCacheSize","getStats","vsize","deleteCount","keys","keys_1","__values","keys_1_1","next","done","key","value","invalidateQueryCache","collectionCacheMap","collectionCacheMap_1","collectionCacheMap_1_1","cacheMap","_c","entries","_d","_e","changeStream","watch","$match","$and","ns.coll","$nin","$not","fullDocument","on","change","coll","close","MongoManagerModel","exports","collection_main","collection_version","mongoManagerModel","versionOptions","MongoManagerUserCollection","MongoManagerCollection","useVersionCollection","useVersions","versionSchema","deepCopy","schema","_id","blackbox","useReportBuilder","reportBuilderLookupTables","timestamps","createLogs","checkSchema","skipCache","setImmediate","createIndex","_id._id","_id.__v","versionCollection","simplschema","rbSchema","useRB","bypassSession","mongoManagerCollection","schemaCopy","interval","default","buildRbLookups","buildRbSchema","setInterval","getMongoManager","clearInterval","extractIndexNameFromError","errorMessage","matches","match","mongoSession","err_5","aggregateCount","err_6","aggregateCursor","cursor","ev","aggregateStream","streamOptions","stream","bulkWrite","operations","bypassCheckSchema","bypassLogs","bypassVersions","BATCH_SIZE","opIndex","sessionOptions","batchOps","slice","logs","versionOps","e_5","batchOps_1","batchOps_1_1","op","opType","Object","doc","validationContext","newContext","isValid","validate","document","replacement","modifier","Error","validationErrors","createdAt","updatedAt","insertOne","objectIdHexString","id_document","payload","method","id_user","user","messageId","route","versionDoc","__assign","__v","$set","$inc","affectedDocs","versionFilters","map","v","$or","versionInserts","bwOptions","ordered","error","e_4","err_7","getServerConfig","getLocalLogManager","writeLogs","affectedDocIds","$in","$sort","$group","versions","$push","$project","versionsToDelete","$slice","$size","$unwind","$replaceRoot","newRoot","oldVersions","deleteMany","error_1","ok","estimatedDocumentCount","err_8","f_docs","Array","isArray","insertMany","fieldOrSpec","indexes","existingIndexes","index","indexQueue","action","specs","createIndexes","indexSpecs","existingIndexes_1","indexesToCreate","indexSpec","existingIndex","docs","i","writeLog","upsert","replaceOne","$lt","res","acknowledged","deletedCount","err_11","deleteOne","findOneAndDelete","returnVal","err_12","err_13","distinct","err_14","drop","err_15","dropIndex","indexName","err_16","dropIndexes","err_17","err_18","findById","id","err_19","findCount","count","err_20","findCursor","removeAllListeners","findStream","err_21","err_22","findOneAndReplace","validation","getMethodManager","callMethod","call","date","err_23","findOneAndUpdate","$setOnInsert","err_24","err_25","indexExists","err_26","bypassMonitor","validationResults","forEach","validDocs","idx","hasOwnProperty","err_27","err_28","listIndexes","rename","newName","err_29","modifiedCount","err_30","prevDoc","docId","docVersion","updatedDoc","getMongoMergeUpdatedDoc","err_31","err_32","returnDocument","safeOptions_1","doc_1","err_33","err_34","updateMany","$unset","objectContainsPropertyDeep","err_35","updateOne","err_36","err_37","err_38","err_39","watchCollection","queue","task","callback","dbCollection","apply","code","err_40","existingIndexName","innerError_1","_super","__extends","authenticate","password","attemptsInterval","Math","pow","attempts","calculatedInterval","last","now","getTime","Users","salt","pbkdf2Promisified","iterations","keylen","digestAlgorithm","hashBuffer","Buffer","hash","err_41","serializeUser","cb","username","deserializeUser","setPassword","randomBytes","saltBuffer","toString","hashRaw","services","err_42","changePassword","oldPassword","newPassword","authUser","register","email","resetAttempts","pbkdf2","reject","err","saltlen","obj","prop"],"mappings":"02GAAAA,S,+KAAAC,QAAA,OAAA,GAEAC,UAAAD,QAAA,YAAA,EACAE,KAAAF,QAAA,IAAA,EACAG,eAAAH,QAAA,cAAA,EACAI,kBAAAJ,QAAA,gCAAA,EAIAK,uBAAAL,QAAA,yBAAA,EACAM,SAAAN,QAAA,gBAAA,EACAO,kBAAAP,QAAA,mBAAA,EACMQ,OAASR,QAAQ,QAAQ,EACzBS,KAAOT,QAAQ,MAAM,EACrBU,SAAU,EAAAR,KAAAS,MAAI,EAAGC,OACjBC,GAAKb,QAAQ,IAAI,EACfc,kBAAsBd,QAAQ,aAAa,EAACc,kBAC9CC,kBAAoB,IAAID,kBAwF9BE,aAAA,WAWC,SAAAA,eAVQC,KAAAC,aAA6D,GAE7DD,KAAAE,UAAsD,GACtDF,KAAAG,qBAA2H,IAAIC,IAC/HJ,KAAAK,UAAYT,GAAGU,kBAAiB,EAAKb,QAErCO,KAAAO,mBAAiF,GACjFP,KAAAQ,kBAAoB,CAAA,EACpBR,KAAAS,kBAAoB,CAAA,CAEb,CA2gBhB,OAzgBcV,aAAAW,OAAb,W,gHAEC,MAAA,CAAA,GADMC,EAAe,IAAIZ,cACNa,WA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,QAAQ,SAACC,EAAS8X,GAAW,OAAAtc,OAAOwb,YAAYgB,EAAS,SAACD,EAAKd,GAAe,OAACc,EAAMD,EAAOC,CAAG,EAAI/X,EAAQiX,CAAU,CAAvC,CAAyC,CAA1F,CAA2F,CACpI,CAEA,SAAS7C,2BAA2B6D,EAAaC,GAChD,IAAI3T,EAAOmG,OAAOnG,KAAK0T,CAAG,EAE1B,GAAI1T,EAAKnF,KAAK,SAAAC,GAAK,OAAAA,IAAM6Y,CAAN,CAAU,EAC5B,MAAO,CAAA,EAGR,IAAK,IAAI1I,EAAI,EAAGA,EAAIjL,EAAK3I,OAAQ4T,CAAC,GAAI,CACrC,IAAI3K,EAAMN,EAAKiL,GACf,GAAIyI,EAAIpT,IAA4B,UAApB,OAAOoT,EAAIpT,IAAqBuP,2BAA2B6D,EAAIpT,GAAMqT,CAAI,EACxF,MAAO,CAAA,C,CAIT,MAAO,CAAA,CACR,CArMa7R,QAAAK,2BAAAA","file":"mongo.manager.js","sourcesContent":["import async from 'async';\nimport { AggregateOptions, AggregationCursor, BulkWriteOptions, BulkWriteResult, ChangeStream, ChangeStreamOptions, Collection, CollectionInfo, CommandOperationOptions, CountDocumentsOptions, CreateCollectionOptions, CreateIndexesOptions, CursorStreamOptions, DeleteOptions, FindCursor, FindOneAndDeleteOptions, FindOneAndReplaceOptions, FindOneAndUpdateOptions, FindOptions, IndexDescription, IndexInformationOptions, InsertOneOptions, ListIndexesCursor, ListIndexesOptions, OptionalUnlessRequiredId, RenameOptions, ReplaceOptions, UpdateOptions } from 'mongodb';\nimport * as NodeCache from 'node-cache';\nimport { cpus } from 'os';\nimport SimpleSchema from 'simpl-schema';\nimport { Users } from '../collections/user.collection';\nimport { CollectionDocument, Document } from '../models/collection-document.model';\nimport { LookupTables } from '../models/report-builder.model';\nimport { UserModel } from '../models/user.model';\nimport { ResolveIOServer } from '../resolveio-server-app';\nimport { buildRbLookups, buildRbSchema, dateReviver, deepCopy, getBinarySize, getMongoMergeUpdatedDoc, objectIdHexString } from '../util/common';\nimport { MonitorMongo } from './monitor.manager';\nconst crypto = require('crypto');\nconst scmp = require('scmp');\nconst numCPUs = cpus().length;\nconst v8 = require('v8');\nconst { AsyncLocalStorage } = require('async_hooks');\nconst asyncLocalStorage = new AsyncLocalStorage();\n\n// export declare interface MongoManagerFilterOperators<T> extends Document {\nexport declare interface MongoManagerFilterParamaterOperators<P> {\n\t$eq?: P;\n\t$gt?: P;\n\t$gte?: P;\n\t$in?: P extends Array<any> ? P : P[];\n\t$lt?: P;\n\t$lte?: P;\n\t$ne?: P;\n\t$nin?: P extends Array<any> ? P : P[];\n\t$not?: P extends string ? MongoManagerFilterParamaterOperators<P> | RegExpConstructor : MongoManagerFilterParamaterOperators<P>;\n\t$exists?: boolean;\n\t$expr?: any[]\n\t$regex?: P extends string ? RegExpConstructor | string : never;\n\t$options?: P extends string ? string : never;\n\t$geoIntersects?: {\n\t\t$geometry: Document;\n\t};\n\t$geoWithin?: Document;\n\t$near?: Document;\n\t$nearSphere?: Document;\n\t$maxDistance?: number;\n\t$all?: any[];\n\t$elemMatch?: Document;\n\t$size?: P extends any[] ? number : never;\n}\n\nexport declare interface MongoManagerFilterOperators<T> extends Document { //TODO: Remove extends document when I get answer on S.O.\n\t$and?: MongoManagerFilter<T>[] | MongoManagerFilterOperators<T>;\n\t$nor?: MongoManagerFilter<T>[] | MongoManagerFilterOperators<T>;\n\t$or?: MongoManagerFilter<T>[] | MongoManagerFilterOperators<T>;\n\t$text?: {\n\t\t$search: string;\n\t\t$language?: string;\n\t\t$caseSensitive?: boolean;\n\t\t$diacriticSensitive?: boolean;\n\t};\n\t// eslint-disable-next-line no-unused-vars\n\t$where?: string | ((this: T) => boolean);\n\t$comment?: string | Document;\n}\n\n// function isDotStringRegExp(obj: Object, dotKey: string): boolean {\n// \tlet keyData = dotKey.split('.');\n// \tlet objData = obj;\n\t\n// \tfor (let i = 0; i < keyData.length; i++) {\n// \t\tlet key = keyData[i];\n// \t\tif (objData.hasOwnProperty(key)) {\n// \t\t\tobjData = objData[key];\n\t\t\t\n// \t\t\tif (i === keyData.length - 1) {\n// \t\t\t\treturn true;\n// \t\t\t}\n// \t\t}\n// \t\telse {\n// \t\t\treturn false;\n// \t\t}\n// \t}\n// }\n\n// export declare type MongoManagerDotStringFilter<T> = {\n// \t[key: string]: (isDotStringRegExp(T, key) ? any : never);\n// };\n\nexport declare type MongoManagerFilter<T> = {\n\t[P in keyof T]?: T[P] | MongoManagerFilterParamaterOperators<T[P]>;\n};\n\nexport declare type MongoManagerUnsetFilter<T> = {\n\t// eslint-disable-next-line no-unused-vars\n\t[P in keyof T]?: number | boolean;\n};\n\nexport declare type MongoManagerIncFilter<T> = {\n\t// eslint-disable-next-line no-unused-vars\n\t[P in keyof T]?: number;\n};\n\nexport declare type MongoManagerUpdateFilter<T> = {\n\t$inc?: MongoManagerIncFilter<T> | Document;\n\t$set?: MongoManagerFilter<T> | Document;\n\t$setOnInsert?: MongoManagerFilter<T> | Document;\n\t$unset?: MongoManagerUnsetFilter<T> | Document;\n};\n\nexport class MongoManager {\n\tprivate _collections: MongoManagerCollection<CollectionDocument>[] = [];\n\tprivate _nodeCache;\n\tprivate _cacheMap: { collections: string[], key: string }[] = [];\n\tprivate _operationInProgress: Map<string, { promise: Promise<any>, invalidatedDuringExecution: boolean, collections: string[] }> = new Map();\n\tprivate _heapSize = v8.getHeapStatistics() / numCPUs;\n\tprivate _heapLimit: number;\n\tprivate _serverCollections: (CollectionInfo | Pick<CollectionInfo, 'name' | 'type'>)[] = [];\n\tprivate _isWorkersEnabled = false;\n\tprivate _isWorkerInstance = false;\n\n\tconstructor() {}\n\n\tstatic async create() {\n\t\tconst mongoManager = new MongoManager();\n\t\tawait mongoManager.initialize();\n\t\treturn mongoManager;\n\t}\n\n\tprivate async initialize() {\n\t\tthis._nodeCache = new NodeCache({ stdTTL: 0, checkperiod: 0 });\n\n\t\tthis._isWorkersEnabled = process.env.IS_WORKERS_ENABLED === 'true';\n\t\tthis._isWorkerInstance = process.env.IS_WORKER_INSTANCE === 'true';\n\t\tthis.setCacheLimit();\n\n\t\tif (this._isWorkersEnabled && this._isWorkerInstance) {\n\t\t\tthis.setupChangeStream();\n\t\t}\n\n\t\tlet collections = await ResolveIOServer.getMainDB().listCollections().toArray();\n\t\tthis._serverCollections = collections;\n\t}\n\n\toneTimeTransaction<T>(fn: () => Promise<T>): Promise<T> {\n\t\treturn asyncLocalStorage.run({}, async () => {\n\t\t\tconst session = ResolveIOServer.getMongoConnection().startSession();\n\t\t\tasyncLocalStorage.getStore().session = session;\n\t\n\t\t\ttry {\n\t\t\t\tlet result: T;\n\t\t\t\t\n\t\t\t\tawait session.withTransaction(async () => {\n\t\t\t\t\t// Directly assign the result from fn()\n\t\t\t\t\tresult = await fn();\n\t\t\t\t\treturn result; // Explicit return for transaction validation\n\t\t\t\t});\n\t\n\t\t\t\treturn result; // Transaction committed successfully\n\t\t\t} \n\t\t\tfinally {\n\t\t\t\tawait session.endSession();\n\t\t\t\tconst store = asyncLocalStorage.getStore();\n\t\t\t\tif (store) delete store.session;\n\t\t\t}\n\t\t});\n\t}\n\t\n\tgetSession() {\n\t\tconst store = asyncLocalStorage.getStore();\n\t\treturn store ? store.session : null;\n\t}\n\n\tprivate setCacheLimit() {\n\t\tif (this._isWorkersEnabled) {\n\t\t\tthis._heapLimit = this._isWorkerInstance ? this._heapSize * 0.8 : this._heapSize * 0.4;\n\t\t}\n\t\telse {\n\t\t\tthis._heapLimit = this._heapSize * 0.3;\n\t\t}\n\t}\n\n\tgetServerCollections() {\n\t\treturn this._serverCollections;\n\t}\n\n\tasync registerCollection(collection: MongoManagerCollection<CollectionDocument>) {\n\t\tif (\n\t\t\tcollection.collectionOptions &&\n\t\t\tcollection.collectionOptions.timeseries &&\n\t\t\tcollection.collectionOptions.timeseries.timeField &&\n\t\t\tthis._serverCollections.some(a => a.name === collection.collectionName && a.type === 'collection')\n\t\t) {\n\t\t\tawait ResolveIOServer.getMainDB().dropCollection(collection.collectionName);\n\t\t\tawait this.createCollection(collection);\n\t\t}\n\n\t\tthis._collections.push(collection);\n\t}\n\n\tasync createCollection(collection: MongoManagerCollection<CollectionDocument>) {\n\t\tawait ResolveIOServer.getMainDB().createCollection(collection.collectionName, collection.collectionOptions);\n\t}\n\n\tcollections() {\n\t\treturn this._collections;\n\t}\n\n\tcollection(collectionName: string): MongoManagerCollection<CollectionDocument> | MongoManagerUserCollection<CollectionDocument> {\n\t\treturn this._collections.find(a => a.collectionName === collectionName);\n\t}\n\n\tprivate async delay(ms: number) {\n\t\t// eslint-disable-next-line no-restricted-syntax\n\t\treturn new Promise(resolve => setTimeout(resolve, ms));\n\t}\n\n\tpublic async find<T extends CollectionDocument>(\n\t\tcollectionName: string,\n\t\tfilter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {},\n\t\toptions?: FindOptions<T>\n\t): Promise<T[]> {\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\t\tconst cacheKey = this.generateCacheKey([collectionName], 'find', [filter, safeOptions]);\n\t\tlet result = this.getFromCache(cacheKey);\n\t\tif (result !== undefined) {\n\t\t\tif (ResolveIOServer.getMainServer().getSubscriptionManager() && ResolveIOServer.getMainServer().getSubscriptionManager().getEnableDebug()) {\n\t\t\t\tconsole.log(new Date(), 'Mongo Find - Cache', collectionName);\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\tif (this._operationInProgress.has(cacheKey)) {\n\t\t\tif (ResolveIOServer.getMainServer().getSubscriptionManager() && ResolveIOServer.getMainServer().getSubscriptionManager().getEnableDebug()) {\n\t\t\t\tconsole.log(new Date(), 'Mongo Find - Already running', collectionName);\n\t\t\t}\n\t\t\treturn this._operationInProgress.get(cacheKey).promise;\n\t\t}\n\n\t\tif (ResolveIOServer.getMainServer().getSubscriptionManager() && ResolveIOServer.getMainServer().getSubscriptionManager().getEnableDebug()) {\n\t\t\tconsole.log(new Date(), 'Mongo Find - Running', collectionName);\n\t\t}\n\n\t\tconst operation = this.executeFind<T>(collectionName, filter, options, cacheKey);\n\t\tthis._operationInProgress.set(cacheKey, { \n\t\t\tpromise: operation, \n\t\t\tinvalidatedDuringExecution: false,\n\t\t\tcollections: [collectionName]\n\t\t});\n\n\t\tawait operation.finally(() => {\n\t\t\tif (ResolveIOServer.getMainServer().getSubscriptionManager() && ResolveIOServer.getMainServer().getSubscriptionManager().getEnableDebug()) {\n\t\t\t\tconsole.log(new Date(), 'Mongo Find - Done', collectionName);\n\t\t\t}\n\n\t\t\tthis._operationInProgress.delete(cacheKey);\n\t\t});\n\n\t\treturn operation;\n\t}\n\n\tprivate async executeFind<T extends CollectionDocument>(\n\t\tcollectionName: string,\n\t\tfilter: MongoManagerFilter<T> & MongoManagerFilterOperators<T>,\n\t\toptions: FindOptions<T> | undefined,\n\t\tcacheKey: string\n\t): Promise<T[]> {\n\t\tlet result;\n\t\tconst collection = ResolveIOServer.getMainDB().collection(collectionName);\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\t\tconst monitor = MonitorMongo.create('find', collectionName, JSON.stringify([filter, safeOptions]));\n\n\t\ttry {\n\t\t\tresult = await collection.find<T>(<any>filter, options).toArray();\n\t\t}\n\t\tcatch (err) {\n\t\t\terr.message = `Error in Execute Find (${collectionName}): ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t\n\t\tif (!this._operationInProgress.get(cacheKey).invalidatedDuringExecution) {\n\t\t\tthis.addToCache([collectionName], cacheKey, result);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t// FindOne Operation\n\tpublic async findOne<T extends CollectionDocument>(\n\t\tcollectionName: string,\n\t\tfilter: MongoManagerFilter<T> | MongoManagerFilterOperators<T> = {},\n\t\toptions?: FindOptions<T>\n\t): Promise<T> {\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\t\tconst cacheKey = this.generateCacheKey([collectionName], 'findOne', [filter, safeOptions]);\n\t\tlet result = this.getFromCache(cacheKey);\n\t\tif (result !== undefined) {\n\t\t\tif (ResolveIOServer.getMainServer().getSubscriptionManager() && ResolveIOServer.getMainServer().getSubscriptionManager().getEnableDebug()) {\n\t\t\t\tconsole.log(new Date(), 'Mongo FindOne - Cache', collectionName);\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}\n\n\t\tif (this._operationInProgress.has(cacheKey)) {\n\t\t\tif (ResolveIOServer.getMainServer().getSubscriptionManager() && ResolveIOServer.getMainServer().getSubscriptionManager().getEnableDebug()) {\n\t\t\t\tconsole.log(new Date(), 'Mongo FindOne - Already running', collectionName);\n\t\t\t}\n\n\t\t\treturn this._operationInProgress.get(cacheKey).promise;\n\t\t}\n\n\t\tif (ResolveIOServer.getMainServer().getSubscriptionManager() && ResolveIOServer.getMainServer().getSubscriptionManager().getEnableDebug()) {\n\t\t\tconsole.log(new Date(), 'Mongo FindOne - Running', collectionName);\n\t\t}\n\n\t\tconst operation = this.executeFindOne<T>(collectionName, filter, options, cacheKey);\n\t\tthis._operationInProgress.set(cacheKey, { \n\t\t\tpromise: operation, \n\t\t\tinvalidatedDuringExecution: false,\n\t\t\tcollections: [collectionName]\n\t\t});\n\n\t\tawait operation.finally(() => {\n\t\t\tif (ResolveIOServer.getMainServer().getSubscriptionManager() && ResolveIOServer.getMainServer().getSubscriptionManager().getEnableDebug()) {\n\t\t\t\tconsole.log(new Date(), 'Mongo FindOne - Done', collectionName);\n\t\t\t}\n\n\t\t\tthis._operationInProgress.delete(cacheKey);\n\t\t});\n\n\t\treturn operation;\n\t}\n\n\tprivate async executeFindOne<T extends CollectionDocument>(\n\t\tcollectionName: string,\n\t\tfilter: MongoManagerFilter<T> | MongoManagerFilterOperators<T>,\n\t\toptions: FindOptions<T> | undefined,\n\t\tcacheKey: string\n\t): Promise<T> {\n\t\tlet result;\n\t\tconst collection = ResolveIOServer.getMainDB().collection(collectionName);\n\t\t\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\t\tconst monitor = MonitorMongo.create('findOne', collectionName, JSON.stringify([filter, safeOptions]));\n\n\t\ttry {\n\t\t\tresult = await collection.findOne<T>(<any>filter, options);\n\t\t}\n\t\tcatch (err) {\n\t\t\terr.message = `Error in Execute Find One (${collectionName}): ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t\n\t\tif (!this._operationInProgress.get(cacheKey).invalidatedDuringExecution) {\n\t\t\tthis.addToCache([collectionName], cacheKey, result);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t// Aggregate Operation\n\tpublic async aggregate<T extends CollectionDocument>(\n\t\tcollectionName: string,\n\t\tpipeline: any[],\n\t\toptions?: AggregateOptions\n\t): Promise<any[]> {\n\t\tconst collections = [collectionName, ...pipeline.flatMap(stage => stage.$lookup?.from ? [stage.$lookup.from] : [])];\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\t\tconst cacheKey = this.generateCacheKey(collections, 'aggregate', [pipeline, safeOptions]);\n\t\tlet result = this.getFromCache(cacheKey);\n\t\tif (result !== undefined) {\n\t\t\tif (ResolveIOServer.getMainServer().getSubscriptionManager() && ResolveIOServer.getMainServer().getSubscriptionManager().getEnableDebug()) {\n\t\t\t\tconsole.log(new Date(), 'Mongo Agg - Cache', collections);\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\tif (this._operationInProgress.has(cacheKey)) {\n\t\t\tif (ResolveIOServer.getMainServer().getSubscriptionManager() && ResolveIOServer.getMainServer().getSubscriptionManager().getEnableDebug()) {\n\t\t\t\tconsole.log(new Date(), 'Mongo Agg - Already running', collections);\n\t\t\t}\n\n\t\t\treturn this._operationInProgress.get(cacheKey).promise;\n\t\t}\n\n\t\tif (ResolveIOServer.getMainServer().getSubscriptionManager() && ResolveIOServer.getMainServer().getSubscriptionManager().getEnableDebug()) {\n\t\t\tconsole.log(new Date(), 'Mongo Agg - Running', collections);\n\t\t}\n\n\t\tconst operation = this.executeAggregate<T>(collectionName, pipeline, options, cacheKey, collections);\n\t\tthis._operationInProgress.set(cacheKey, { \n\t\t\tpromise: operation, \n\t\t\tinvalidatedDuringExecution: false,\n\t\t\tcollections: collections\n\t\t});\n\n\t\tawait operation.finally(() => {\n\t\t\tif (ResolveIOServer.getMainServer().getSubscriptionManager() && ResolveIOServer.getMainServer().getSubscriptionManager().getEnableDebug()) {\n\t\t\t\tconsole.log(new Date(), 'Mongo Agg - Done', collections);\n\t\t\t}\n\n\t\t\tthis._operationInProgress.delete(cacheKey);\n\t\t});\n\n\t\treturn operation;\n\t}\n\n\tprivate async executeAggregate<T extends CollectionDocument>(\n\t\tcollectionName: string,\n\t\tpipeline: any[],\n\t\toptions: AggregateOptions | undefined,\n\t\tcacheKey: string,\n\t\tcollections: string[]\n\t): Promise<any[]> {\n\t\tlet result;\n\t\tconst collection = ResolveIOServer.getMainDB().collection(collectionName);\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\t\tconst monitor = MonitorMongo.create('aggregate', collectionName, JSON.stringify([pipeline, safeOptions]));\n\n\t\ttry {\n\t\t\tresult = await collection.aggregate<T>(pipeline, options).toArray();\n\t\t}\n\t\tcatch (err) {\n\t\t\terr.message = `Error in Execute Aggregate (${collectionName}): ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\n\t\tif (!this._operationInProgress.get(cacheKey).invalidatedDuringExecution) {\n\t\t\tthis.addToCache(collections, cacheKey, result);\n\t\t}\n\t\t\n\t\treturn result;\n\t}\n\n\tpublic async countDocuments<T extends CollectionDocument>(\n\t\tcollectionName: string,\n\t\tfilter: MongoManagerFilter<T> | MongoManagerFilterOperators<T> = {},\n\t\toptions?: CountDocumentsOptions\n\t): Promise<number> {\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\t\tconst cacheKey = this.generateCacheKey([collectionName], 'countDocuments', [filter, safeOptions]);\n\t\tlet result = this.getFromCache(cacheKey);\n\t\tif (result !== undefined) {\n\t\t\treturn result;\n\t\t}\n\n\t\tif (this._operationInProgress.has(cacheKey)) {\n\t\t\treturn this._operationInProgress.get(cacheKey).promise;\n\t\t}\n\n\t\tconst operation = this.executeCountDocuments<T>(collectionName, filter, options, cacheKey);\n\t\tthis._operationInProgress.set(cacheKey, { \n\t\t\tpromise: operation, \n\t\t\tinvalidatedDuringExecution: false,\n\t\t\tcollections: [collectionName]\n\t\t});\n\n\t\tawait operation.finally(() => this._operationInProgress.delete(cacheKey));\n\n\t\treturn operation;\n\t}\n\n\tprivate async executeCountDocuments<T extends CollectionDocument>(\n\t\tcollectionName: string,\n\t\tfilter: MongoManagerFilter<T> | MongoManagerFilterOperators<T>,\n\t\toptions: CountDocumentsOptions,\n\t\tcacheKey: string\n\t): Promise<number> {\n\t\tlet result;\n\t\tconst collection = ResolveIOServer.getMainDB().collection(collectionName);\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\t\tconst monitor = MonitorMongo.create('countDocuments', collectionName, JSON.stringify([filter, safeOptions]));\n\n\t\ttry {\n\t\t\tresult = await collection.countDocuments(<any>filter, options);\n\t\t}\n\t\tcatch (err) {\n\t\t\terr.message = `Error in Execute Count Documents (${collectionName}): ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t\n\t\tif (!this._operationInProgress.get(cacheKey).invalidatedDuringExecution) {\n\t\t\tthis.addToCache([collectionName], cacheKey, result);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t// Cache and Invalidation Setup\n\tprivate generateCacheKey(collections: string[], functionName: string, args: any[]): string {\n\t\tconst keyString = JSON.stringify({ collections, functionName, args });\n\t\treturn crypto.createHash('sha256').update(keyString).digest('hex');\n\t}\n\n\tprivate getFromCache(cacheKey: string): any | undefined {\n\t\ttry {\n\t\t\tconst cachedData = this._nodeCache.get(cacheKey);\n\t\t\tif (cachedData) {\n\t\t\t\treturn JSON.parse(cachedData, dateReviver);\n\t\t\t}\n\t\t} catch {\n\t\t\tthis._nodeCache.del(cacheKey);\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate addToCache(collections: string[], cacheKey: string, data: any) {\n\t\tif (getBinarySize(JSON.stringify(data)) < 1000000 && \n\t\t\t!collections.includes('logs') &&\n\t\t\t!collections.find(a => a.endsWith('.versions')) &&\n\t\t\t!collections.find(a => a.startsWith('monitor-'))\n\t\t) {\n\t\t\tlet nodeCacheSize = this._nodeCache.getStats().vsize;\n\n\t\t\tif (nodeCacheSize > this._heapLimit) {\n\t\t\t\tlet deleteCount = 0;\n\t\t\t\tconst keys = this._nodeCache.keys();\n\n\t\t\t\tfor (const key of keys) {\n\t\t\t\t\tthis._nodeCache.del(key);\n\t\t\t\t\tdeleteCount += 1;\n\n\t\t\t\t\tnodeCacheSize = this._nodeCache.getStats().vsize;\n\n\t\t\t\t\tif (nodeCacheSize < this._heapLimit * 0.75) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconsole.log('Query Cache: ' + 'Too Big, - Deleted: ' + deleteCount + ' - ' + nodeCacheSize);\n\t\t\t}\n\t\t\t\n\t\t\tthis._nodeCache.set(cacheKey, JSON.stringify(data));\n\t\t\tthis._cacheMap.push({ collections, key: cacheKey });\n\t\t}\n\t}\n\n\tpublic invalidateQueryCache(collection: string) {\n\t\tconst collectionCacheMap = this._cacheMap.filter(a => a.collections.includes(collection));\n\n\t\tif (ResolveIOServer.getMainServer().getSubscriptionManager() && ResolveIOServer.getMainServer().getSubscriptionManager().getEnableDebug()) {\n\t\t\tconsole.log(new Date(), 'Mongo Invalidate Cache', collection);\n\t\t}\n\n\t\tfor (const cacheMap of collectionCacheMap) {\n\t\t\tthis._nodeCache.del(cacheMap.key);\n\t\t\t\n\t\t\tif (this._operationInProgress.has(cacheMap.key)) {\n\t\t\t\tthis._operationInProgress.get(cacheMap.key).invalidatedDuringExecution = true;\n\n\t\t\t\tif (ResolveIOServer.getMainServer().getSubscriptionManager() && ResolveIOServer.getMainServer().getSubscriptionManager().getEnableDebug()) {\n\t\t\t\t\tconsole.log(new Date(), 'Mongo Invalidated During Execution', cacheMap.collections);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tfor (const [key, operation] of this._operationInProgress.entries()) {\n\t\t\tif (operation.collections.includes(collection)) {\n\t\t\t\toperation.invalidatedDuringExecution = true;\n\t\t\n\t\t\t\tif (ResolveIOServer.getMainServer().getSubscriptionManager() && ResolveIOServer.getMainServer().getSubscriptionManager().getEnableDebug()) {\n\t\t\t\t\tconsole.log(new Date(), 'Mongo Invalidated During Execution (No cache)', operation.collections);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tthis._cacheMap = this._cacheMap.filter(a => !a.collections.includes(collection));\n\t}\n\n\tprivate setupChangeStream() {\n\t\tconst db = ResolveIOServer.getMainDB();\n\n\t\tconst pipeline = [\n\t\t\t{\n\t\t\t\t$match: {\n\t\t\t\t\t$and: [\n\t\t\t\t\t\t{'ns.coll': { $nin: [\n\t\t\t\t\t\t\t'log-method-latencies', \n\t\t\t\t\t\t\t'log-subscriptions', \n\t\t\t\t\t\t\t'logs', \n\t\t\t\t\t\t\t'counters', \n\t\t\t\t\t\t\t'cron-job-histories', \n\t\t\t\t\t\t\t'email-histories',\n\t\t\t\t\t\t\t'qb-soap-request-histories', \n\t\t\t\t\t\t\t'qb-soap-request-responses', \n\t\t\t\t\t\t\t'qb-soap-requests',\n\t\t\t\t\t\t\t'qb-soap-retries'\n\t\t\t\t\t\t] }},\n\t\t\t\t\t\t{'ns.coll': { $not: /.*\\.versions$/ }},\n\t\t\t\t\t\t{'ns.coll': { $not: /^monitor-/ }},\n\t\t\t\t\t]\n\t\t\t\t},\n\t\t\t},\n\t\t];\n\t\tconst changeStream = db.watch(pipeline, { fullDocument: 'updateLookup' });\n\n\t\tchangeStream.on('change', (change: any) => {\n\t\t\tif (change['ns'] && change['ns'].coll) {\n\t\t\t\tconst collectionName = change['ns'].coll;\n\t\t\t\tconst collection = this.collection(collectionName);\n\n\t\t\t\tif (collection) {\n\t\t\t\t\tthis.invalidateQueryCache(collectionName);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tchangeStream.on('error', async () => {\n\t\t\tconsole.log(new Date(), 'Mongo change stream error. Restart...');\n\t\t\tawait changeStream.close();\n\t\t\tsetTimeout(() => this.setupChangeStream(), 5000);\n\t\t});\n\n\t\tchangeStream.on('close', () => {\n\t\t\tconsole.log(new Date(), 'Mongo change stream closed. Restarting...');\n\t\t\tsetTimeout(() => this.setupChangeStream(), 5000);\n\t\t});\n\t}\n}\n\nexport class MongoManagerModel<T extends CollectionDocument> {\n\tcollection_main: MongoManagerCollection<T> | MongoManagerUserCollection<T> = null;\n\tcollection_version: MongoManagerCollection<T> | MongoManagerUserCollection<T> = null;\n\n\tconstructor() {}\n\n\tstatic create<T>(options: MongoManagerCollectionOptions): MongoManagerModel<T> {\n\t\tconst mongoManagerModel = new MongoManagerModel<T>();\n\t\tmongoManagerModel.initialize(options);\n\t\treturn mongoManagerModel;\n\t}\n\n\tprivate initialize(options: MongoManagerCollectionOptions) {\n\t\tif (options.collectionName === 'users') {\n\t\t\tthis.collection_main = MongoManagerUserCollection.create(options) as MongoManagerUserCollection<T>;\n\t\t}\n\t\telse {\n\t\t\tthis.collection_main = MongoManagerCollection.create(options) as MongoManagerCollection<T>;\n\t\t}\n\n\t\tif (options.useVersionCollection) {\n\t\t\tthis.collection_main.useVersions = true;\n\t\t\t\n\t\t\tlet versionSchema = deepCopy(options.schema);\n\t\t\tversionSchema._id.type = 'Object';\n\t\t\tversionSchema._id.blackbox = true;\n\n\t\t\tlet versionOptions: MongoManagerCollectionOptions = {\n\t\t\t\tcollectionName: options.collectionName + '.versions',\n\t\t\t\tschema: versionSchema,\n\t\t\t\tuseVersionCollection: false,\n\t\t\t\tuseReportBuilder: false,\n\t\t\t\treportBuilderLookupTables: [],\n\t\t\t\ttimestamps: true,\n\t\t\t\tcreateLogs: false,\n\t\t\t\tcheckSchema: false,\n\t\t\t\tcollectionOptions: null,\n\t\t\t\tskipCache: true\n\t\t\t};\n\n\t\t\tif (options.collectionName === 'users') {\t\n\t\t\t\tthis.collection_version = MongoManagerUserCollection.create(versionOptions) as MongoManagerUserCollection<T>;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthis.collection_version = MongoManagerCollection.create(versionOptions) as MongoManagerCollection<T>;\n\t\t\t}\n\n\t\t\tsetImmediate(async () => {\n\t\t\t\tawait this.collection_version.createIndex({'_id._id': 1, '_id.__v': 1});\n\t\t\t});\n\n\t\t\tthis.collection_main.versionCollection = options.collectionName + '.versions';\n\t\t}\n\t}\n}\n\nexport interface MongoManagerCollectionOptions {\n\tcollectionName: string;\n\tschema: object;\n\tuseVersionCollection: boolean;\n\tuseReportBuilder: boolean;\n\treportBuilderLookupTables: LookupTables[]\n\ttimestamps: boolean;\n\tcreateLogs: boolean;\n\tcheckSchema: boolean;\n\tcollectionOptions: CreateCollectionOptions;\n\tskipCache?: boolean;\n\tbypassSession?: boolean;\n}\n\nexport class MongoManagerCollection<T extends CollectionDocument> {\n\tcollectionName = '';\n\tcheckSchema = false;\n\tsimplschema = null;\n\trbSchema = null;\n\ttimestamps = false;\n\tuseVersions = false;\n\tversionCollection = '';\n\tcreateLogs = true;\n\tuseRB = false;\n\tcollectionOptions: CreateCollectionOptions;\n\tskipCache = false;\n\tbypassSession = false;\n\t\n\tconstructor() {}\n\t\n\tstatic create(options: MongoManagerCollectionOptions) {\n\t\tconst mongoManagerCollection = new MongoManagerCollection();\n\t\tmongoManagerCollection.initialize(options);\n\t\treturn mongoManagerCollection;\n\t}\n\n\tinitialize(options: MongoManagerCollectionOptions) {\n\t\tthis.collectionName = options.collectionName;\n\t\tthis.simplschema = new SimpleSchema(options.schema);\n\t\tthis.timestamps = options.timestamps;\n\t\tthis.createLogs = options.createLogs;\n\t\tthis.checkSchema = options.checkSchema;\n\t\tthis.collectionOptions = options.collectionOptions;\n\t\tthis.skipCache = options.skipCache || false;\n\t\tthis.bypassSession = options.bypassSession || false;\n\n\t\tif (options.useReportBuilder) {\n\t\t\tthis.useRB = true;\n\t\t\tlet schemaCopy = deepCopy(options.schema);\n\t\t\tlet rbSchema = buildRbLookups(options.reportBuilderLookupTables, schemaCopy, []);\n\t\t\tthis.rbSchema = buildRbSchema(rbSchema);\n\t\t}\n\n\t\tlet interval = setInterval(async () => {\n\t\t\tif (ResolveIOServer && ResolveIOServer.getMainServer() && ResolveIOServer.getMongoManager() && ResolveIOServer.getMongoManager().getServerCollections().length) {\n\t\t\t\tawait ResolveIOServer.getMongoManager().registerCollection(this);\n\t\t\t\tclearInterval(interval);\n\t\t\t}\n\t\t}, 1);\n\t}\n\n\tprivate static indexQueue = async.queue(async (task, callback) => {\n\t\tconst { action, collection, specs, options } = task;\n\t\tconst dbCollection = ResolveIOServer.getMainDB().collection(collection.collectionName, collection.collectionOptions);\n\t\n\t\tif (!dbCollection) {\n\t\t\treturn callback(new Error(`Collection ${collection.collectionName} not found`));\n\t\t}\n\t\n\t\ttry {\n\t\t\t// Try creating the index, will auto-skip if already checked in createIndex/createIndexes\n\t\t\tconst result = await dbCollection[action](...specs, options);\n\t\t\tcallback(null, result);\n\t\t} catch (err) {\n\t\t\t// Handle any specific errors related to index creation\n\t\t\tif (err.code === 85 || err.message.includes('IndexOptionsConflict')) {\n\t\t\t\ttry {\n\t\t\t\t\tconst existingIndexName = collection.extractIndexNameFromError(err.message);\n\t\t\t\t\tif (existingIndexName) {\n\t\t\t\t\t\tawait dbCollection.dropIndex(existingIndexName);\n\t\t\t\t\t\tconst result = await dbCollection[action](...specs, options);\n\t\t\t\t\t\tcallback(null, result);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t} catch (innerError) {\n\t\t\t\t\tcallback(innerError);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcallback(err);\n\t\t}\n\t}, 1);\n\n\t// Method to extract index name from error message\n\textractIndexNameFromError(errorMessage) {\n\t\tlet regexPattern = /Index already exists with a different name: (\\S+)/;\n\t\tlet matches = errorMessage.match(regexPattern);\n\t\n\t\tif (!matches || matches.length <= 1) {\n\t\t\t// If the first pattern doesn't match, try the second pattern\n\t\t\tregexPattern = /existing index:.*name: \"([^\"]+)\"/;\n\t\t\tmatches = errorMessage.match(regexPattern);\n\t\t}\n\t\n\t\treturn matches && matches.length > 1 ? matches[1] : null;\n\t}\n\n\tasync aggregate(pipeline: object[], options?: AggregateOptions, skipCache = false, bypassSession = false) : Promise<any[]> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (!skipCache && !this.skipCache) {\n\t\t\treturn ResolveIOServer.getMongoManager().aggregate(this.collectionName, pipeline, options);\n\t\t}\n\t\telse {\n\t\t\t// eslint-disable-next-line no-unused-vars\n\t\t\tlet { session, ...safeOptions } = options || {};\n\t\t\tlet monitor = MonitorMongo.create('aggregate', this.collectionName, JSON.stringify([pipeline, safeOptions]));\n\n\t\t\ttry {\n\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).aggregate(pipeline, options).toArray();\n\t\t\t\treturn res;\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tconsole.log(new Date(), 'Error Aggregate', this.collectionName, JSON.stringify([pipeline, safeOptions, err], null, 2));\n\t\t\t\terr.message = `Error in Aggregate: ${this.collectionName} - ${err.message}`;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tawait monitor.finish();\n\t\t\t}\n\t\t}\n\t}\n\n\tasync aggregateCount(pipeline: object[], options?: AggregateOptions, bypassSession = false) : Promise<number> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\t\tlet monitor = MonitorMongo.create('aggregateCount', this.collectionName, JSON.stringify([pipeline, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).aggregate(pipeline, options).toArray();\n\t\t\treturn res.length;\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Aggregate Count', this.collectionName, JSON.stringify([pipeline, safeOptions, err], null, 2));\n\t\t\terr.message = `Error in Aggregate Count: ${this.collectionName} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\taggregateCursor(pipeline: object[], options?: AggregateOptions, bypassSession = false): AggregationCursor {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\t\tlet monitor = MonitorMongo.create('aggregateCursor', this.collectionName, JSON.stringify([pipeline, safeOptions]));\n\t\tlet cursor = ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).aggregate(pipeline, options);\n\t\tcursor.on('close', async ev => {\n\t\t\tawait monitor.finish();\n\t\t\treturn ev;\n\t\t});\n\n\t\treturn cursor;\n\t}\n\n\taggregateStream(pipeline: object[], options?: AggregateOptions, streamOptions?: CursorStreamOptions, bypassSession = false) {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\t\tlet monitor = MonitorMongo.create('aggregateStream', this.collectionName, JSON.stringify([pipeline, safeOptions, streamOptions]));\n\t\tlet stream = ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).aggregate(pipeline, options).stream(streamOptions).on('close', async ev => {\n\t\t\tawait monitor.finish();\n\t\t\treturn ev;\n\t\t});\n\n\t\treturn stream;\n\t}\n\n\tasync bulkWrite(\n\t\toperations: any[],\n\t\toptions?: BulkWriteOptions,\n\t\tbypassCheckSchema = false,\n\t\tbypassLogs = false,\n\t\tbypassVersions = false, \n\t\tbypassSession = false\n\t): Promise<BulkWriteResult> {\n\t\tif (!operations.length) {\n\t\t\treturn null;\n\t\t}\n\t\n\t\tconst BATCH_SIZE = 1000;\n\t\tlet opIndex = 0;\n\n\t\tlet sessionOptions = null;\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\t\n\t\twhile (opIndex < operations.length) {\n\t\t\tconst batchOps = operations.slice(opIndex, opIndex + BATCH_SIZE);\n\t\n\t\t\t// Initialize arrays for logs and version operations\n\t\t\tconst logs = [];\n\t\t\tconst versionOps = [];\n\t\n\t\t\tfor (const op of batchOps) {\n\t\t\t\tconst opType = Object.keys(op)[0];\n\t\t\t\tconst doc = op[opType];\n\t\n\t\t\t\t// Skip validation if bypassCheckSchema is true\n\t\t\t\tif (this.checkSchema && !bypassCheckSchema) {\n\t\t\t\t\tconst validationContext = this.simplschema.newContext();\n\t\t\t\t\tlet isValid: boolean;\n\t\n\t\t\t\t\tif (opType === 'insertOne') {\n\t\t\t\t\t\tisValid = validationContext.validate(doc.document);\n\t\t\t\t\t}\n\t\t\t\t\telse if (opType === 'replaceOne') {\n\t\t\t\t\t\tisValid = validationContext.validate(doc.replacement);\n\t\t\t\t\t}\n\t\t\t\t\telse if (opType === 'updateOne' || opType === 'updateMany') {\n\t\t\t\t\t\t// For updates, validate the update modifier\n\t\t\t\t\t\tisValid = validationContext.validate(doc.update, { modifier: true });\n\t\t\t\t\t}\n\t\t\t\t\telse if (opType === 'deleteOne' || opType === 'deleteMany') {\n\t\t\t\t\t\t// No validation needed for deletes\n\t\t\t\t\t\tisValid = true;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tthrow new Error(`Unsupported operation type: ${opType}`);\n\t\t\t\t\t}\n\t\n\t\t\t\t\tif (!isValid) {\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t`Schema validation failed for ${opType}: ${JSON.stringify(validationContext.validationErrors())}`\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\t// Now proceed to process the operations\n\t\n\t\t\t\tif (opType === 'insertOne') {\n\t\t\t\t\t// If this.timestamps is true, set createdAt and updatedAt\n\t\t\t\t\tif (this.timestamps) {\n\t\t\t\t\t\tif (!doc.document.createdAt) {\n\t\t\t\t\t\t\tdoc.document.createdAt = new Date();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (!doc.document.updatedAt) {\n\t\t\t\t\t\t\tdoc.document.updatedAt = new Date();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Prepare log entry\n\t\t\t\t\tif (!bypassLogs && this.createLogs) {\n\t\t\t\t\t\tlogs.push({\n\t\t\t\t\t\t\tinsertOne: {\n\t\t\t\t\t\t\t\tdocument: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: doc.document._id || objectIdHexString(),\n\t\t\t\t\t\t\t\t\tpayload:\n\t\t\t\t\t\t\t\t\t\tgetBinarySize(JSON.stringify(doc.document)) < 200000\n\t\t\t\t\t\t\t\t\t\t\t? JSON.stringify(doc.document, null, 2)\n\t\t\t\t\t\t\t\t\t\t\t: 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: 'insertOne',\n\t\t\t\t\t\t\t\t\tid_user: '', // Add user info if available\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date(),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Prepare version document\n\t\t\t\t\tif (!bypassVersions && this.useVersions) {\n\t\t\t\t\t\tconst versionDoc = {\n\t\t\t\t\t\t\t...doc.document,\n\t\t\t\t\t\t\t__v: 0,\n\t\t\t\t\t\t\t_id: { _id: doc.document._id || objectIdHexString(), __v: 0 },\n\t\t\t\t\t\t};\n\t\t\t\t\t\tversionOps.push({\n\t\t\t\t\t\t\tinsertOne: {\n\t\t\t\t\t\t\t\tdocument: versionDoc\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Since we might have modified doc.document, update the operation\n\t\t\t\t\top[opType].document = doc.document;\n\t\t\t\t}\n\t\t\t\telse if (opType === 'updateOne' || opType === 'updateMany') {\n\t\t\t\t\t// If this.timestamps is true, add updatedAt\n\t\t\t\t\tif (this.timestamps) {\n\t\t\t\t\t\tif (!doc.update.$set) {\n\t\t\t\t\t\t\tdoc.update.$set = {};\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdoc.update.$set.updatedAt = new Date();\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// If this.useVersions is true, increment __v\n\t\t\t\t\tif (!bypassVersions && this.useVersions) {\n\t\t\t\t\t\tif (!doc.update.$inc) {\n\t\t\t\t\t\t\tdoc.update.$inc = {};\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdoc.update.$inc.__v = 1;\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Prepare log entry\n\t\t\t\t\tif (!bypassLogs && this.createLogs) {\n\t\t\t\t\t\tlogs.push({\n\t\t\t\t\t\t\tinsertOne: {\n\t\t\t\t\t\t\t\tdocument: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: doc.filter._id || null,\n\t\t\t\t\t\t\t\t\tpayload:\n\t\t\t\t\t\t\t\t\t\tgetBinarySize(JSON.stringify(doc.update)) < 200000\n\t\t\t\t\t\t\t\t\t\t\t? JSON.stringify(doc.update, null, 2)\n\t\t\t\t\t\t\t\t\t\t\t: 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: opType,\n\t\t\t\t\t\t\t\t\tid_user: '', // Add user info if available\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date(),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// For versioning, store the filter to fetch the document later\n\t\t\t\t\tif (!bypassVersions && this.useVersions) {\n\t\t\t\t\t\tversionOps.push({\n\t\t\t\t\t\t\tfilter: doc.filter,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// No need to modify the operation further\n\t\t\t\t}\n\t\t\t\telse if (opType === 'replaceOne') {\n\t\t\t\t\t// If this.timestamps is true, set updatedAt\n\t\t\t\t\tif (this.timestamps) {\n\t\t\t\t\t\tdoc.replacement.updatedAt = new Date();\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// If this.useVersions is true, increment __v\n\t\t\t\t\tif (!bypassVersions && this.useVersions) {\n\t\t\t\t\t\tdoc.replacement.__v = (doc.replacement.__v || 0) + 1;\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Prepare log entry\n\t\t\t\t\tif (!bypassLogs && this.createLogs) {\n\t\t\t\t\t\tlogs.push({\n\t\t\t\t\t\t\tinsertOne: {\n\t\t\t\t\t\t\t\tdocument: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: doc.filter._id || null,\n\t\t\t\t\t\t\t\t\tpayload:\n\t\t\t\t\t\t\t\t\t\tgetBinarySize(JSON.stringify(doc.replacement)) < 200000\n\t\t\t\t\t\t\t\t\t\t\t? JSON.stringify(doc.replacement, null, 2)\n\t\t\t\t\t\t\t\t\t\t\t: 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\t\t\tid_user: '', // Add user info if available\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date(),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// For versioning, store the filter to fetch the document later\n\t\t\t\t\tif (!bypassVersions && this.useVersions) {\n\t\t\t\t\t\tversionOps.push({\n\t\t\t\t\t\t\tfilter: doc.filter,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Since we might have modified doc.replacement, update the operation\n\t\t\t\t\top[opType].replacement = doc.replacement;\n\t\t\t\t}\n\t\t\t\telse if (opType === 'deleteOne' || opType === 'deleteMany') {\n\t\t\t\t\t// Prepare log entry\n\t\t\t\t\tif (!bypassLogs && this.createLogs) {\n\t\t\t\t\t\tlogs.push({\n\t\t\t\t\t\t\tinsertOne: {\n\t\t\t\t\t\t\t\tdocument: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: doc.filter._id || null,\n\t\t\t\t\t\t\t\t\tpayload:\n\t\t\t\t\t\t\t\t\t\tgetBinarySize(JSON.stringify(doc.filter)) < 200000\n\t\t\t\t\t\t\t\t\t\t\t? JSON.stringify(doc.filter, null, 2)\n\t\t\t\t\t\t\t\t\t\t\t: 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: opType,\n\t\t\t\t\t\t\t\t\tid_user: '', // Add user info if available\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date(),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// For versioning, store the filter to fetch the document later\n\t\t\t\t\tif (!bypassVersions && this.useVersions) {\n\t\t\t\t\t\tversionOps.push({\n\t\t\t\t\t\t\tfilter: doc.filter,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// No need to modify the operation\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthrow new Error(`Unsupported operation type: ${opType}`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet affectedDocs = [];\n\t\n\t\t\t// Handle versioning\n\t\t\tif (!bypassVersions && this.useVersions && versionOps.length > 0) {\n\t\t\t\ttry {\n\t\t\t\t\t// Fetch the affected documents\n\t\t\t\t\tconst versionFilters = versionOps.map((v) => v.filter);\n\t\t\t\t\taffectedDocs = await ResolveIOServer.getMainDB().collection(this.collectionName).find({ $or: versionFilters }, sessionOptions).toArray();\n\t\t\n\t\t\t\t\t// Prepare version documents\n\t\t\t\t\tconst versionInserts = affectedDocs.map((doc) => ({\n\t\t\t\t\t\tinsertOne: {\n\t\t\t\t\t\t\tdocument: {\n\t\t\t\t\t\t\t\t...doc,\n\t\t\t\t\t\t\t\t_id: { _id: doc._id, __v: doc.__v },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t}));\n\t\t\n\t\t\t\t\t// Insert versions in bulk\n\t\t\t\t\tif (versionInserts.length > 0) {\n\t\t\t\t\t\tlet bwOptions = null;\n\t\t\t\t\t\tif (!sessionOptions) {\n\t\t\t\t\t\t\tbwOptions = {ordered: false};\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tbwOptions = {session: mongoSession, ordered: false};\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection(this.versionCollection).bulkWrite(<any>versionInserts, bwOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch(e) {\n\t\t\t\t\tconsole.error('Error during version creation:', e);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// eslint-disable-next-line no-unused-vars\n\t\t\tlet { session, ...safeOptions } = options || {};\n\n\t\t\t// Execute bulkWrite\n\t\t\tconst monitor = MonitorMongo.create('bulkWrite', this.collectionName, JSON.stringify([batchOps, safeOptions]));\n\n\t\t\ttry {\n\t\t\t\tawait ResolveIOServer.getMainDB().collection(this.collectionName).bulkWrite(batchOps, options);\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\terr.message = `Error in Bulk Write: ${this.collectionName} - ${err.message}`;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tawait monitor.finish();\n\t\t\t}\n\t\n\t\t\t// Insert logs in bulk\n\t\t\tif (!bypassLogs && this.createLogs && logs.length > 0) {\n\t\t\t\tif (\n\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t) {\n\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLogs(logs.map(a => {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\tdata: a\n\t\t\t\t\t\t};\n\t\t\t\t\t}));\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tlet bwOptions = null;\n\t\t\t\t\tif (!sessionOptions) {\n\t\t\t\t\t\tbwOptions = {ordered: false};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tbwOptions = {session: mongoSession, ordered: false};\n\t\t\t\t\t}\n\n\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').bulkWrite(logs, bwOptions);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!bypassVersions && this.useVersions) {\n\t\t\t\t// Delete old versions beyond the latest 5\n\t\t\t\ttry {\n\t\t\t\t\tconst affectedDocIds = affectedDocs.map((doc) => doc._id);\n\t\n\t\t\t\t\tconst pipeline = [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$match: { '_id._id': { $in: affectedDocIds } },\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$sort: { '_id._id': 1, '_id.__v': -1 },\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$group: {\n\t\t\t\t\t\t\t\t_id: '$_id._id',\n\t\t\t\t\t\t\t\tversions: { $push: '$_id' },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$project: {\n\t\t\t\t\t\t\t\tversionsToDelete: { $slice: ['$versions', 5, { $size: '$versions' }] },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{ $unwind: '$versionsToDelete' },\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$replaceRoot: { newRoot: { _id: '$versionsToDelete' } },\n\t\t\t\t\t\t},\n\t\t\t\t\t];\n\t\n\t\t\t\t\tconst oldVersions = await ResolveIOServer.getMainDB().collection(this.versionCollection).aggregate(pipeline, sessionOptions).toArray();\n\t\n\t\t\t\t\tif (oldVersions.length > 0) {\n\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection(this.versionCollection).deleteMany({ _id: { $in: oldVersions.map((v) => v._id) } }, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch (error) {\n\t\t\t\t\tconsole.error('Error during version cleanup:', error);\n\t\t\t\t\t// Handle the error as needed\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\topIndex += BATCH_SIZE;\n\t\n\t\t\t// Yield to the event loop\n\t\t\t// eslint-disable-next-line no-restricted-syntax\n\t\t\tawait new Promise((resolve) => setImmediate(resolve));\n\t\n\t\t\t// Invalidate cache\n\t\t\tif (!this.skipCache) {\n\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t}\n\t\t}\n\t\n\t\treturn { ok: 1 } as BulkWriteResult; // Adjust return value as per your requirements\n\t}\n\n\tasync countDocuments(\n\t\tfilter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {},\n\t\toptions?: CountDocumentsOptions,\n\t\tskipCache = false, \n\t\tbypassSession = false\n\t): Promise<number> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\t\t\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\t// Check if the filter is empty\n\t\tconst isUnfiltered = Object.keys(filter).length === 0;\n\n\t\tif (isUnfiltered) {\n\t\t\t// Use collection stats for an unfiltered count\n\t\t\treturn ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).estimatedDocumentCount(options);\n\t\t}\n\t\telse if (!skipCache && !this.skipCache) {\n\t\t\t// Use cached count if skipCache is false\n\t\t\treturn ResolveIOServer.getMongoManager().countDocuments(this.collectionName, filter, options);\n\t\t}\n\t\telse {\n\t\t\t// Fallback to direct countDocuments call with monitoring if skipCache is true\n\n\t\t\tlet monitor = MonitorMongo.create('countDocuments', this.collectionName, JSON.stringify([filter, safeOptions]));\n\n\t\t\ttry {\n\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).countDocuments(<any>filter, options);\n\t\t\t\treturn res;\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tconsole.log(new Date(), 'Error Count Documents', this.collectionName, filter, safeOptions, err);\n\t\t\t\terr.message = `Error in Count Documents: ${this.collectionName} - ${err.message}`;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tawait monitor.finish();\n\t\t\t}\n\t\t}\n\t}\n\n\t//Helper Function (1 or Many) - Not Real Mongo Function\n\tcreate(f_docs: T | T[], options?: InsertOneOptions | BulkWriteOptions): Promise<T | T[]> {\n\t\tif (!Array.isArray(f_docs)) {\n\t\t\treturn this.insertOne(f_docs, <InsertOneOptions>options);\n\t\t}\n\t\telse if (f_docs.length === 1) {\n\t\t\treturn this.insertOne(f_docs[0], <InsertOneOptions>options);\n\t\t}\n\n\t\treturn this.insertMany(f_docs, <BulkWriteOptions>options);\n\t}\n\n\tasync createIndex(fieldOrSpec: any, options?: CreateIndexesOptions): Promise<string> {\n\t\ttry {\n\t\t\t// Check if index already exists based on the key\n\t\t\tconst dbCollection = ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions);\n\t\t\tconst existingIndexes = await dbCollection.indexes();\n\n\t\t\t// Check if an index with the same key already exists\n\t\t\tconst indexExists = existingIndexes.some(index => \n\t\t\t\tJSON.stringify(index.key) === JSON.stringify(fieldOrSpec)\n\t\t\t);\n\n\t\t\tif (indexExists) {\n\t\t\t\treturn 'Index already exists'; // Skip creation if index exists\n\t\t\t}\n\n\t\t\t// If index doesn't exist, push it to the queue\n\t\t\tMongoManagerCollection.indexQueue.push({\n\t\t\t\taction: 'createIndex',\n\t\t\t\tcollection: this,\n\t\t\t\tspecs: [fieldOrSpec],\n\t\t\t\toptions: options\n\t\t\t}, (error, result) => {\n\t\t\t\tif (error) throw error;\n\t\t\t\telse return result;\n\t\t\t});\n\n\t\t\treturn 'Index creation queued';\n\t\t} \n\t\tcatch (err) {\n\t\t\tthrow err;\n\t\t}\n\t}\n\t\n\tasync createIndexes(indexSpecs: IndexDescription[], options?: CreateIndexesOptions): Promise<string[]> {\n\t\ttry {\n\t\t\tconst dbCollection = ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions);\n\t\t\tconst existingIndexes = await dbCollection.indexes();\n\n\t\t\t// Filter out indexes that already exist based on the key\n\t\t\tconst indexesToCreate = indexSpecs.filter(indexSpec => \n\t\t\t\t!existingIndexes.some(existingIndex => \n\t\t\t\t\tJSON.stringify(existingIndex.key) === JSON.stringify(indexSpec.key)\n\t\t\t\t)\n\t\t\t);\n\n\t\t\t// If no new indexes to create, resolve early\n\t\t\tif (indexesToCreate.length === 0) {\n\t\t\t\treturn ['All indexes already exist'];\n\t\t\t}\n\n\t\t\t// Push only new indexes to the queue\n\t\t\tMongoManagerCollection.indexQueue.push({\n\t\t\t\taction: 'createIndexes',\n\t\t\t\tcollection: this,\n\t\t\t\tspecs: [indexesToCreate],\n\t\t\t\toptions: options\n\t\t\t}, (error, result) => {\n\t\t\t\tif (error) throw error;\n\t\t\t\telse return result;\n\t\t\t});\n\n\t\t\treturn ['Index creation queued'];\n\t\t} \n\t\tcatch (err) {\n\t\t\tthrow err;\n\t\t}\n\t}\n\t\n\tasync deleteMany(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {}, options?: DeleteOptions, bypassLogs = false, bypassSession = false): Promise<number> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\t\t\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tif ((this.createLogs && !bypassLogs) || this.useVersions) {\n\t\t\tlet docs = await this.find(filter);\n\n\t\t\tfor (let i = 0; i < docs.length; i++) {\n\t\t\t\tlet doc = docs[i];\n\t\t\t\n\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t) {\n\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, safeOptions])) < 200000 ? JSON.stringify([doc, filter, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'deleteMany',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, safeOptions])) < 200000 ? JSON.stringify([doc, filter, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\tmethod: 'deleteMany',\n\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.useVersions) {\n\t\t\t\t\tlet versionDoc = deepCopy(doc);\n\t\t\t\t\tversionDoc._id = {_id: doc._id, __v: doc.__v};\n\n\t\t\t\t\tlet versionOptions = null;\n\t\t\t\t\tif (!sessionOptions) {\n\t\t\t\t\t\tversionOptions = {upsert: true};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tversionOptions = {session: mongoSession, upsert: true};\n\t\t\t\t\t}\n\n\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, versionOptions);\n\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).deleteMany(<any>{$and: [{'_id._id': doc._id}, {'_id.__v': {$lt: doc.__v - 1}}]}, sessionOptions);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tlet monitor = MonitorMongo.create('deleteMany', this.collectionName, JSON.stringify([filter, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).deleteMany(<any>filter, options);\n\t\t\tif (res.acknowledged) {\n\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t}\n\t\t\t\treturn res.deletedCount;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new Error(`Error in DeleteMany: ${this.collectionName}`);\n\t\t\t}\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Delete Many', this.collectionName, filter, safeOptions, err);\n\t\t\terr.message = `Error in Delete Many: ${this.collectionName} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync deleteOne(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {}, options?: FindOneAndDeleteOptions, bypassLogs = false, bypassSession = false): Promise<number> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tif (this.createLogs && !bypassLogs) {\n\t\t\tlet monitor = MonitorMongo.create('findOneAndDelete', this.collectionName, JSON.stringify([filter, safeOptions]));\n\t\t\t\n\t\t\ttry {\n\t\t\t\tlet returnVal = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).findOneAndDelete(<any>filter, options);\n\t\t\t\tlet doc = returnVal.value;\n\n\t\t\t\tif (doc) {\n\t\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: doc._id as string,\n\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, safeOptions])) < 200000 ? JSON.stringify([doc, filter, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: 'deleteOne',\n\t\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: doc._id as string,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, safeOptions])) < 200000 ? JSON.stringify([doc, filter, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'deleteOne',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (this.useVersions) {\n\t\t\t\t\t\tlet versionDoc = deepCopy(doc);\n\t\t\t\t\t\tversionDoc._id = {_id: doc._id, __v: doc.__v};\n\n\t\t\t\t\t\tlet versionOptions = null;\n\t\t\t\t\t\tif (!sessionOptions) {\n\t\t\t\t\t\t\tversionOptions = {upsert: true};\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tversionOptions = {session, upsert: true};\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, versionOptions);\n\t\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).deleteMany(<any>{$and: [{'_id._id': doc._id}, {'_id.__v': {$lt: doc.__v - 1}}]}, sessionOptions);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tconsole.log(new Date(), 'Error Delete One (Find One And Delete)', this.collectionName, filter, safeOptions, err);\n\t\t\t\terr.message = `Error in Delete One (Find One And Delete): ${this.collectionName} - ${err.message}`;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tawait monitor.finish();\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tlet monitor = MonitorMongo.create('deleteOne', this.collectionName, JSON.stringify([filter, safeOptions]));\n\n\t\t\ttry {\n\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).deleteOne(<any>filter, options);\n\t\t\t\tif (res.acknowledged) {\n\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t}\n\t\t\t\t\treturn res.deletedCount;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthrow new Error(`Error in Delete One: ${this.collectionName}`);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tconsole.log(new Date(), 'Error Delete One', this.collectionName, filter, safeOptions, err);\n\t\t\t\terr.message = `Error in Delete One: ${this.collectionName} - ${err.message}`;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tawait monitor.finish();\n\t\t\t}\n\t\t}\n\t}\n\n\tasync distinct(key: string, filter?: MongoManagerFilter<T> & MongoManagerFilterOperators<T>, options?: CommandOperationOptions, bypassSession = false): Promise<T[]> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('distinct', this.collectionName, JSON.stringify([key, filter, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).distinct(key, <any>filter, options);\n\t\t\treturn res;\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Distinct', this.collectionName, filter, safeOptions, err);\n\t\t\terr.message = `Error in Distinct: ${this.collectionName} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync drop(options?: CommandOperationOptions, bypassSession = false): Promise<boolean> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('drop', this.collectionName, JSON.stringify([safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).drop(options);\n\t\t\treturn res;\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Count Documents', this.collectionName, safeOptions, err);\n\t\t\terr.message = `Error in Count Documents: ${this.collectionName} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync dropIndex(indexName: string, options?: CommandOperationOptions, bypassSession = false): Promise<Document> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('dropIndex', this.collectionName, JSON.stringify([indexName, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).dropIndex(indexName, options);\n\t\t\treturn <Document>res;\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Drop Index', this.collectionName, indexName, safeOptions, err);\n\t\t\terr.message = `Error in Drop Index: ${this.collectionName} - ${indexName} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync dropIndexes(options?: CommandOperationOptions, bypassSession = false): Promise<Document> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('dropIndexes', this.collectionName, JSON.stringify([safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).dropIndexes(options);\n\t\t\treturn res;\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Drop Indexes', this.collectionName, safeOptions, err);\n\t\t\terr.message = `Error in Drop Indexes: ${this.collectionName} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync find(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {}, options?: FindOptions<T>, skipCache = false, bypassSession = false): Promise<T[]> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tif (!skipCache && !this.skipCache) {\n\t\t\treturn ResolveIOServer.getMongoManager().find(this.collectionName, filter, options);\n\t\t}\n\t\telse {\n\t\t\tlet monitor = MonitorMongo.create('find', this.collectionName, JSON.stringify([filter, safeOptions]));\n\n\t\t\ttry {\n\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).find<T>(<any>filter, options).toArray();\n\t\t\t\treturn res;\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tconsole.log(new Date(), 'Error Find', this.collectionName, filter, safeOptions, err);\n\t\t\t\terr.message = `Error in Find: ${this.collectionName} - ${JSON.stringify(filter, null, 2)} - ${err.message}`;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tawait monitor.finish();\n\t\t\t}\n\t\t}\n\t}\n\n\tasync findById(id: string, options?: FindOptions<T>, skipCache = false, bypassSession = false): Promise<T> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tif (!skipCache && !this.skipCache) {\n\t\t\treturn ResolveIOServer.getMongoManager().findOne(this.collectionName, {_id: id}, options);\n\t\t}\n\t\telse {\n\t\t\tlet monitor = MonitorMongo.create('findById', this.collectionName, JSON.stringify([{_id: id}, safeOptions]));\n\t\t\t\n\t\t\ttry {\n\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).findOne<T>(<any>{_id: id}, options);\n\t\t\t\treturn res;\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tconsole.log(new Date(), 'Error Find By Id', this.collectionName, {_id: id}, safeOptions, err);\n\t\t\t\terr.message = `Error in Find By ID: ${this.collectionName} - ${id} - ${err.message}`;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tawait monitor.finish();\n\t\t\t}\n\t\t}\n\t}\n\n\tasync findCount(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {}, options?: FindOptions<T>, bypassSession = false): Promise<Number> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('findCount', this.collectionName, JSON.stringify([filter, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).find(<any>filter, options).count();\n\t\t\treturn res;\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Find Count', this.collectionName, filter, safeOptions, err);\n\t\t\terr.message = `Error in Find Count: ${this.collectionName} - ${JSON.stringify(filter, null, 2)} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tfindCursor(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {}, options?: FindOptions<T>, bypassSession = false): FindCursor {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\t\t\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('findCursor', this.collectionName, JSON.stringify([filter, safeOptions]));\n\t\tlet cursor = ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).find(<any>filter, options);\n\t\tcursor.on('close', async ev => {\n\t\t\tawait monitor.finish();\n\t\t\tcursor.removeAllListeners();\n\t\t\treturn ev;\n\t\t});\n\n\t\treturn cursor;\n\t}\n\n\tfindStream(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {}, options?: FindOptions<T>, streamOptions?: CursorStreamOptions, bypassSession = false) {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\t\t\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\t\t\n\t\tlet monitor = MonitorMongo.create('findStream', this.collectionName, JSON.stringify([filter, safeOptions, streamOptions]));\n\t\tlet stream = ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).find(<any>filter, options).stream(streamOptions).on('close', async ev => {\n\t\t\tawait monitor.finish();\n\t\t\treturn ev;\n\t\t});\n\n\t\treturn stream;\n\t}\n\n\tasync findOne(filter: MongoManagerFilter<T> | MongoManagerFilterOperators<T> = {}, options?: FindOptions<T>, skipCache = false, bypassSession = false): Promise<T> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\tif (!skipCache && !this.skipCache) {\n\t\t\treturn ResolveIOServer.getMongoManager().findOne(this.collectionName, filter, options);\n\t\t}\n\t\telse {\n\t\t\t// eslint-disable-next-line no-unused-vars\n\t\t\tlet { session, ...safeOptions } = options || {};\n\n\t\t\tlet monitor = MonitorMongo.create('findOne', this.collectionName, JSON.stringify([filter, safeOptions]));\n\t\t\t\n\t\t\ttry {\n\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).findOne<T>(<any>filter, options);\n\t\t\t\treturn res;\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tconsole.log(new Date(), 'Error Find One', this.collectionName, filter, safeOptions, err);\n\t\t\t\terr.message = `Error in Find One: ${this.collectionName} - ${JSON.stringify(filter, null, 2)} - ${err.message}`;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tawait monitor.finish();\n\t\t\t}\n\t\t}\n\t}\n\n\tasync findOneAndDelete(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {}, options?: FindOneAndDeleteOptions, bypassLogs = false, bypassSession = false): Promise<T> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('findOneAndDelete', this.collectionName, JSON.stringify([filter, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).findOneAndDelete(<any>filter, options);\n\t\t\tlet doc = res.value;\n\t\t\t\n\t\t\tif (doc) {\n\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t) {\n\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: doc._id as string,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, safeOptions])) < 200000 ? JSON.stringify([doc, filter, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'findOneAndDelete',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\tid_document: doc._id as string,\n\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, safeOptions])) < 200000 ? JSON.stringify([doc, filter, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\tmethod: 'findOneAndDelete',\n\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.useVersions) {\n\t\t\t\t\tlet versionDoc = deepCopy(doc);\n\t\t\t\t\tversionDoc._id = {_id: doc._id, __v: doc.__v};\n\n\t\t\t\t\tlet versionOptions = null;\n\t\t\t\t\tif (!sessionOptions) {\n\t\t\t\t\t\tversionOptions = {upsert: true};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tversionOptions = {session, upsert: true};\n\t\t\t\t\t}\n\n\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, versionOptions);\n\t\t\t\t}\n\n\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t}\n\n\t\t\t\treturn <T>doc;\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Find One And Delete', this.collectionName, filter, safeOptions, err);\n\t\t\terr.message = `Error in Find One And Delete: ${this.collectionName} - ${JSON.stringify(filter, null, 2)} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync findOneAndReplace(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {}, replacement: T, options?: FindOneAndReplaceOptions, bypassLogs = false, bypassCheckSchema = false, bypassSession = false): Promise<T> {\n\t\tif (this.checkSchema && !bypassCheckSchema) {\n\t\t\tconst validation = this.simplschema.newContext();\n\t\t\tconst isValid = validation.validate(replacement);\n\n\t\t\tif (!isValid) {\n\t\t\t\tconsole.log(new Date(), this.collectionName, 'Schema Errors - findOneAndReplace', validation.validationErrors());\n\t\t\t\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on findOneAndReplace - ' + this.collectionName, [validation.validationErrors(), replacement]);\n\t\t\t\t\n\t\t\t\tthrow validation.validationErrors();\n\t\t\t}\n\t\t}\n\t\t\n\t\tlet date = new Date();\n\n\t\tif (this.timestamps) {\n\t\t\treplacement.updatedAt = date;\n\t\t}\n\n\t\tif (options && options.upsert) {\n\t\t\tif (!replacement._id) {\n\t\t\t\treplacement._id = objectIdHexString();\n\t\t\t}\n\n\t\t\tif (this.useVersions) {\n\t\t\t\treplacement.__v = 0;\n\t\t\t}\n\n\t\t\tif (this.timestamps && !replacement.createdAt) {\n\t\t\t\treplacement.createdAt = date;\n\t\t\t}\n\t\t}\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('findOneAndReplace', this.collectionName, JSON.stringify([filter, replacement, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).findOneAndReplace(<any>filter, replacement, options);\n\t\t\tlet doc = res.value;\n\n\t\t\tif (doc) {\n\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t) {\n\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: doc._id as string,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, replacement, safeOptions])) < 200000 ? JSON.stringify([doc, filter, replacement, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'findOneAndReplace',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\tid_document: doc._id as string,\n\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, replacement, safeOptions])) < 200000 ? JSON.stringify([doc, filter, replacement, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\tmethod: 'findOneAndReplace',\n\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.useVersions) {\n\t\t\t\t\tlet versionDoc = deepCopy(doc);\n\t\t\t\t\tversionDoc._id = {_id: doc._id, __v: doc.__v};\n\n\t\t\t\t\tlet versionOptions = null;\n\t\t\t\t\tif (!sessionOptions) {\n\t\t\t\t\t\tversionOptions = {upsert: true};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tversionOptions = {session, upsert: true};\n\t\t\t\t\t}\n\n\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, versionOptions);\n\t\t\t\t}\n\n\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t}\n\n\t\t\t\treturn <T>doc;\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Find One And Replace', this.collectionName, filter, safeOptions, err);\n\t\t\terr.message = `Error in Find One And Replace: ${this.collectionName} - ${JSON.stringify(filter, null, 2)} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync findOneAndUpdate(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {}, update: MongoManagerUpdateFilter<T>, options?: FindOneAndUpdateOptions, bypassLogs = false, bypassCheckSchema = false, bypassSession = false): Promise<T> {\n\t\tif (this.checkSchema && !bypassCheckSchema) {\n\t\t\tconst validation = this.simplschema.newContext();\n\t\t\tconst isValid = validation.validate(update, {modifier: true});\n\n\t\t\tif (!isValid) {\n\t\t\t\tconsole.log(new Date(), this.collectionName, 'Schema Errors - findOneAndUpdate', validation.validationErrors());\n\t\t\t\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on findOneAndUpdate - ' + this.collectionName, [validation.validationErrors(), update]);\n\t\t\t\tthrow validation.validationErrors();\n\t\t\t}\n\t\t}\n\n\t\tif (this.timestamps) {\n\t\t\tlet date = new Date(); \n\t\t\t\n\t\t\tif (!update.$set) {\n\t\t\t\tupdate.$set = <any>{updatedAt: date};\n\t\t\t}\n\t\t\telse {\n\t\t\t\tupdate.$set.updatedAt = date;\n\t\t\t}\n\t\t}\n\n\t\tif (options && options.upsert) {\n\t\t\tif (!update.$setOnInsert) {\n\t\t\t\tif (this.timestamps) {\n\t\t\t\t\tupdate.$setOnInsert = <any>{\n\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tupdate.$setOnInsert = <any>{\n\t\t\t\t\t\t_id: objectIdHexString()\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (!update.$setOnInsert._id) {\n\t\t\t\t\tupdate.$setOnInsert._id = objectIdHexString();\n\t\t\t\t}\n\n\t\t\t\tif (this.timestamps && !update.$setOnInsert.createdAt) {\n\t\t\t\t\tupdate.$setOnInsert.createdAt = new Date();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('findOneAndUpdate', this.collectionName, JSON.stringify([filter, update, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).findOneAndUpdate(<any>filter, <any>update, options);\n\t\t\tlet doc = res.value;\n\n\t\t\tif (doc) {\n\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t) {\t\n\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: <string>doc._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, update, safeOptions])) < 200000 ? JSON.stringify([doc, filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'findOneAndUpdate',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\tid_document: <string>doc._id,\n\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, update, safeOptions])) < 200000 ? JSON.stringify([doc, filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\tmethod: 'findOneAndUpdate',\n\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.useVersions) {\n\t\t\t\t\tlet versionDoc = deepCopy(doc);\n\t\t\t\t\tversionDoc._id = {_id: doc._id, __v: doc.__v};\n\n\t\t\t\t\tlet versionOptions = null;\n\t\t\t\t\tif (!sessionOptions) {\n\t\t\t\t\t\tversionOptions = {upsert: true};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tversionOptions = {session, upsert: true};\n\t\t\t\t\t}\n\n\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, versionOptions);\n\t\t\t\t}\n\n\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\treturn <T>doc;\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Find One And Update', this.collectionName, filter, safeOptions, err);\n\t\t\terr.message = `Error in Find One And Update: ${this.collectionName} - ${JSON.stringify(filter, null, 2)} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync indexes(options: IndexInformationOptions, bypassSession = false): Promise<any[]> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('indexes', this.collectionName, JSON.stringify([safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).indexes(options);\n\t\t\treturn res;\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Indexes', this.collectionName, safeOptions, err);\n\t\t\terr.message = `Error in Indexes: ${this.collectionName} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync indexExists(indexes: string | string[], options?: IndexInformationOptions, bypassSession = false): Promise<boolean> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('indexExists', this.collectionName, JSON.stringify([indexes, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).indexExists(indexes, options);\n\t\t\treturn res;\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Index Exists', this.collectionName, indexes, safeOptions, err);\n\t\t\terr.message = `Error in Index Exists: ${this.collectionName} - ${JSON.stringify(indexes, null, 2)} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync insertMany(docs: T[], options?: BulkWriteOptions, bypassLogs = false, bypassCheckSchema = false, bypassMonitor = false, bypassSession = false): Promise<T[]> {\n\t\tif (!docs.length) {\n\t\t\treturn [];\n\t\t}\n\t\t\n\t\tlet validationResults = [];\n\n\t\tif (this.checkSchema && !bypassCheckSchema) {\n\t\t\tdocs.forEach(doc => {\n\t\t\t\tconst validation = this.simplschema.newContext();\n\t\t\t\tconst isValid = validation.validate(doc);\n\n\t\t\t\tif (!isValid) {\n\t\t\t\t\tconsole.log(new Date(), this.collectionName, 'Schema Errors - insertMany', validation.validationErrors());\n\t\t\t\t\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on insertMany - ' + this.collectionName, [validation.validationErrors(), doc]);\n\t\t\t\t\tvalidationResults.push(false);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tvalidationResults.push(true);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tlet validDocs = this.checkSchema ? docs.filter((a, idx) => validationResults[idx]) : docs;\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tfor (let i = 0; i < validDocs.length; i++) {\n\t\t\tlet doc = validDocs[i];\n\n\t\t\tif (!doc._id) {\n\t\t\t\tdoc._id = objectIdHexString();\n\t\t\t}\n\n\t\t\tif (this.timestamps) {\n\t\t\t\tlet date = new Date();\n\n\t\t\t\tif (!doc.createdAt) {\n\t\t\t\t\tdoc.createdAt = date;\n\t\t\t\t}\n\n\t\t\t\tif (!doc.updatedAt) {\n\t\t\t\t\tdoc.updatedAt = date;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.useVersions && !doc.hasOwnProperty('__v')) {\n\t\t\t\tdoc.__v = 0;\n\t\t\t}\n\n\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\tif (\n\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t) {\n\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, safeOptions])) < 200000 ? JSON.stringify([doc, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\tmethod: 'insertMany',\n\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, safeOptions])) < 200000 ? JSON.stringify([doc, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\tmethod: 'insertMany',\n\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\troute: '',\n\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t}, sessionOptions);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (validDocs.length) {\n\t\t\tlet monitor = null;\n\t\t\t\n\t\t\tif (!bypassMonitor) {\n\t\t\t\tmonitor = MonitorMongo.create('insertMany', this.collectionName, JSON.stringify([validDocs, safeOptions]));\n\t\t\t}\n\t\t\t\n\t\t\ttry {\n\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).insertMany(<OptionalUnlessRequiredId<T>[]>validDocs, options);\n\n\t\t\t\tif (res.acknowledged) {\n\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t}\n\t\t\t\t\treturn validDocs;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthrow new Error(`Error in Insert Many: ${this.collectionName} - ${JSON.stringify(res, null, 2)}`);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tconsole.log(new Date(), 'Error Insert Many', this.collectionName, validDocs, safeOptions, err);\n\t\t\t\terr.message = `Error in Insert Many: ${this.collectionName} - ${err.message}`;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tif (monitor) {\n\t\t\t\t\tmonitor.finish();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn [];\n\t}\n\n\tasync insertOne(doc: T, options?: InsertOneOptions, bypassLogs = false, bypassCheckSchema = false, bypassSession = false): Promise<T> {\n\t\tif (!doc._id) {\n\t\t\tdoc._id = objectIdHexString();\n\t\t}\n\n\t\tif (this.checkSchema && !bypassCheckSchema) {\n\t\t\tconst validation = this.simplschema.newContext();\n\t\t\tconst isValid = validation.validate(doc);\n\n\t\t\tif (!isValid) {\n\t\t\t\tconsole.log(new Date(), this.collectionName, 'Schema Errors - insertOne', validation.validationErrors());\n\t\t\t\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on insertOne - ' + this.collectionName, [validation.validationErrors(), doc]);\n\t\t\t\tthrow validation.validationErrors();\n\t\t\t}\n\t\t}\n\n\t\tif (this.timestamps) {\n\t\t\tlet date = new Date();\n\t\t\n\t\t\tif (!doc.createdAt) {\n\t\t\t\tdoc.createdAt = date;\n\t\t\t}\n\n\t\t\tif (!doc.updatedAt) {\n\t\t\t\tdoc.updatedAt = date;\n\t\t\t}\n\t\t}\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tif (this.createLogs && !bypassLogs) {\n\t\t\tif (\n\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t) {\n\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\ttype: 'log',\n\t\t\t\t\tdata: {\n\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, safeOptions])) < 200000 ? JSON.stringify([doc, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\tmethod: 'insertOne',\n\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\troute: '',\n\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\telse {\n\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\ttype: 'document',\n\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, safeOptions])) < 200000 ? JSON.stringify([doc, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\tmethod: 'insertOne',\n\t\t\t\t\tid_user: '',\n\t\t\t\t\tuser: '',\n\t\t\t\t\tmessageId: 0,\n\t\t\t\t\troute: '',\n\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t}, sessionOptions);\n\t\t\t}\n\t\t}\n\n\t\tif (this.useVersions && !doc.hasOwnProperty('__v')) {\n\t\t\tdoc.__v = 0;\n\t\t}\n\n\t\tlet monitor = MonitorMongo.create('insertOne', this.collectionName, JSON.stringify([doc, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).insertOne(<OptionalUnlessRequiredId<T>>doc, options);\n\t\t\tif (res.acknowledged) {\n\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t}\n\t\t\t\treturn doc;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new Error(`Error in Insert One: ${this.collectionName} - ${JSON.stringify(res, null, 2)}`);\n\t\t\t}\n\t\t}\n\t\tcatch(err) {\n\t\t\tconsole.log(new Date(), 'Error Insert One', this.collectionName, doc, safeOptions, err);\n\t\t\terr.message = `Error in Insert One: ${this.collectionName} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tlistIndexes(options?: ListIndexesOptions, bypassSession = false): ListIndexesCursor {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\t\t\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('listIndexes', this.collectionName, JSON.stringify([safeOptions]));\n\t\tlet cursor = ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).listIndexes(options);\n\t\tcursor.on('close', async ev => {\n\t\t\tawait monitor.finish();\n\t\t\treturn ev;\n\t\t});\n\n\t\treturn cursor;\n\t}\n\n\tasync rename(newName: string, options?: RenameOptions, bypassSession = false): Promise<Collection<Document>> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('rename', this.collectionName, JSON.stringify([newName, safeOptions]));\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).rename(newName, options);\n\t\t\treturn res;\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Rename', this.collectionName, newName, safeOptions, err);\n\t\t\terr.message = `Error in Rename: ${this.collectionName} - ${newName} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync replaceOne(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T>, replacement: T, options?: ReplaceOptions, bypassLogs = false, bypassCheckSchema = false, doc: T = null, bypassSession = false) : Promise<number> {\n\t\tif (this.checkSchema && !bypassCheckSchema) {\n\t\t\tconst validation = this.simplschema.newContext();\n\t\t\tconst isValid = validation.validate(replacement);\n\n\t\t\tif (!isValid) {\n\t\t\t\tconsole.log(new Date(), this.collectionName, 'Schema Errors - replaceOne', validation.validationErrors());\n\t\t\t\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on replaceOne - ' + this.collectionName, [validation.validationErrors(), replacement]);\n\t\t\t\tthrow validation.validationErrors();\n\t\t\t}\n\t\t}\n\t\t\n\t\tlet date = new Date();\n\t\t\n\t\tif (this.timestamps) {\n\t\t\treplacement.updatedAt = date;\n\t\t}\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tif (this.useVersions) {\n\t\t\tif (!doc) {\n\t\t\t\tdoc = await this.findOne(<any>filter, null, true);\n\t\t\t}\n\n\t\t\tif (doc) {\n\t\t\t\tif (this.timestamps && !replacement.createdAt && doc.createdAt) {\n\t\t\t\t\treplacement.createdAt = doc.createdAt;\n\t\t\t\t}\n\n\t\t\t\tif (doc.__v === replacement.__v) {\n\t\t\t\t\treplacement.__v += 1;\n\n\t\t\t\t\tlet versionDoc = deepCopy(doc);\n\t\t\t\t\tversionDoc._id = {_id: doc._id, __v: doc.__v};\n\n\t\t\t\t\tlet versionOptions = null;\n\t\t\t\t\tif (!sessionOptions) {\n\t\t\t\t\t\tversionOptions = {upsert: true};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tversionOptions = {session, upsert: true};\n\t\t\t\t\t}\n\n\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, versionOptions);\n\n\t\t\t\t\tif (doc.__v >= 4) {\n\t\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).deleteMany(<any>{$and: [{'_id._id': doc._id}, {'_id.__v': {$lt: doc.__v - 4}}]}, sessionOptions);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, replacement, safeOptions])) < 200000 ? JSON.stringify([doc, filter, replacement, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, replacement, safeOptions])) < 200000 ? JSON.stringify([doc, filter, replacement, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tlet monitor = MonitorMongo.create('replaceOne', this.collectionName, JSON.stringify([filter, replacement, safeOptions]));\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).replaceOne(<any>filter, replacement, options);\n\t\t\t\t\t\tif (res.acknowledged) {\n\t\t\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn res.modifiedCount;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tthrow new Error(`Error in Replace One: ${this.collectionName} - ${JSON.stringify(res, null, 2)}`);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcatch (err) {\n\t\t\t\t\t\tconsole.log(new Date(), 'Error Replace One', this.collectionName, filter, replacement, safeOptions, err);\n\t\t\t\t\t\terr.message = `Error in Replace One: ${this.collectionName} - ${err.message}`;\n\t\t\t\t\t\tthrow err;\n\t\t\t\t\t}\n\t\t\t\t\tfinally {\n\t\t\t\t\t\tawait monitor.finish();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tconsole.log('invalid version - ' + this.collectionName, doc.__v, replacement.__v);\n\n\t\t\t\t\tlet prevDoc = await ResolveIOServer.getMongoManager().collection(this.versionCollection).findOne({\n\t\t\t\t\t\t_id: <any>{\n\t\t\t\t\t\t\t_id: doc._id,\n\t\t\t\t\t\t\t__v: replacement.__v\n\t\t\t\t\t\t}\n\t\t\t\t\t}, null, true);\n\n\t\t\t\t\tif (prevDoc) {\n\t\t\t\t\t\tlet docId = doc._id;\n\t\t\t\t\t\tlet docVersion = doc.__v;\n\t\t\t\t\t\tlet updatedDoc: T = getMongoMergeUpdatedDoc(replacement, doc, prevDoc);\n\t\t\t\t\t\tupdatedDoc._id = docId;\n\t\t\t\t\t\tupdatedDoc.__v = docVersion + 1;\n\n\t\t\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\t\tid_document: docId,\n\t\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['invalidVersion - merge', doc, filter, updatedDoc, safeOptions])) < 200000 ? JSON.stringify(['invalidVersion - merge', doc, filter, updatedDoc, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: docId,\n\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['invalidVersion - merge', doc, filter, updatedDoc, safeOptions])) < 200000 ? JSON.stringify(['invalidVersion - merge', doc, filter, updatedDoc, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlet monitor = MonitorMongo.create('replaceOne', this.collectionName, JSON.stringify([filter, updatedDoc, safeOptions]));\n\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).replaceOne(<any>filter, updatedDoc, options);\n\t\t\t\t\t\t\tif (res.acknowledged) {\n\t\t\t\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn res.modifiedCount;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tthrow new Error(`Error in Replace One: ${this.collectionName} - ${JSON.stringify(res, null, 2)}`);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch (err) {\n\t\t\t\t\t\t\tconsole.log(new Date(), 'Error Replace One', this.collectionName, filter, updatedDoc, safeOptions, err);\n\t\t\t\t\t\t\terr.message = `Error in Replace One: ${this.collectionName} - ${err.message}`;\n\t\t\t\t\t\t\tthrow err;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfinally {\n\t\t\t\t\t\t\tawait monitor.finish();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tthrow new Error('Error in Replcae One: Invalid Version And Could Not Find History - DB: ' + doc.__v + ', Trying to update with :' + replacement.__v);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (options && options.upsert) {\n\t\t\t\tif (this.timestamps) {\n\t\t\t\t\treplacement.createdAt = date;\n\t\t\t\t}\n\n\t\t\t\tif (!replacement._id) {\n\t\t\t\t\treplacement._id = objectIdHexString();\n\t\t\t\t}\n\n\t\t\t\treplacement.__v = 0;\n\n\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t) {\n\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: replacement._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['upsert', filter, replacement, safeOptions])) < 200000 ? JSON.stringify(['upsert', filter, replacement, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\tid_document: replacement._id,\n\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['upsert', filter, replacement, safeOptions])) < 200000 ? JSON.stringify(['upsert', filter, replacement, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tlet monitor = MonitorMongo.create('replaceOne', this.collectionName, JSON.stringify([filter, replacement, safeOptions]));\n\n\t\t\t\ttry {\n\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).replaceOne(<any>filter, replacement, options);\n\t\t\t\t\tif (res.acknowledged) {\n\t\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn res.modifiedCount;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tthrow new Error(`Error in Replace One: ${this.collectionName} - ${JSON.stringify(res, null, 2)}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(new Date(), 'Error Replace One', this.collectionName, filter, replacement, safeOptions, err);\n\t\t\t\t\terr.message = `Error in Replace One: ${this.collectionName} - ${err.message}`;\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t\tfinally {\n\t\t\t\t\tawait monitor.finish();\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new Error('Error in Replace One: No Document');\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tif (options && options.upsert) {\n\t\t\t\tif (this.timestamps && !replacement.createdAt) {\n\t\t\t\t\treplacement.createdAt = date;\n\t\t\t\t}\n\n\t\t\t\tif (!replacement._id) {\n\t\t\t\t\treplacement._id = objectIdHexString();\n\t\t\t\t}\n\n\t\t\t\treplacement.__v = 0;\n\t\t\t}\n\n\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\tif (!options) {\n\t\t\t\t\toptions = <FindOneAndReplaceOptions>{returnDocument: 'before'};\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t(<FindOneAndReplaceOptions>options).returnDocument = 'before';\n\t\t\t\t}\n\n\t\t\t\t// eslint-disable-next-line no-unused-vars\n\t\t\t\tlet { session, ...safeOptions } = options || {};\n\n\t\t\t\tlet monitor = MonitorMongo.create('findOneAndReplace', this.collectionName, JSON.stringify([filter, replacement, safeOptions]));\n\n\t\t\t\ttry {\n\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).findOneAndReplace(<any>filter, replacement, <FindOneAndReplaceOptions>options);\n\t\t\t\t\tlet doc = res.value;\n\n\t\t\t\t\tif (doc) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: <string>doc._id,\n\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, replacement, safeOptions])) < 200000 ? JSON.stringify([doc, filter, replacement, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: <string>doc._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, replacement, safeOptions])) < 200000 ? JSON.stringify([doc, filter, replacement, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: replacement._id,\n\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['upsert', filter, replacement, safeOptions])) < 200000 ? JSON.stringify(['upsert', filter, replacement, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: replacement._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['upsert', filter, replacement, safeOptions])) < 200000 ? JSON.stringify(['upsert', filter, replacement, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(new Date(), 'Error Replace One (Find One And Replace)', this.collectionName, filter, replacement, safeOptions, err);\n\t\t\t\t\terr.message = `Error in Replace One (Find One And Replace): ${this.collectionName} - ${err.message}`;\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t\tfinally {\n\t\t\t\t\tawait monitor.finish();\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tlet monitor = MonitorMongo.create('replaceOne', this.collectionName, JSON.stringify([filter, replacement, safeOptions]));\n\n\t\t\t\ttry {\n\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).replaceOne(<any>filter, replacement, options);\n\t\t\t\t\tif (res.acknowledged) {\n\t\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn res.modifiedCount;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\treturn res.acknowledged;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(new Date(), 'Error Replace One', this.collectionName, filter, replacement, safeOptions, err);\n\t\t\t\t\terr.message = `Error in Aggregate: ${this.collectionName} - ${err.message}`;\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t\tfinally {\n\t\t\t\t\tawait monitor.finish();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tasync updateMany(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T>, update: MongoManagerUpdateFilter<T>, options?: UpdateOptions, bypassLogs = false, bypassCheckSchema = false, bypassVersions = false, bypassSession = false) : Promise<number> {\n\t\tif ((!update.$inc || JSON.stringify(update.$inc) === '{}') && (!update.$set || JSON.stringify(update.$set) === '{}') && (!update.$setOnInsert || JSON.stringify(update.$setOnInsert) === '{}') && (!update.$unset || JSON.stringify(update.$unset) === '{}')) {\n\t\t\treturn 1;\n\t\t}\n\t\t\n\t\tif (this.timestamps) {\n\t\t\tlet date = new Date();\n\n\t\t\tif (!update.$set) {\n\t\t\t\tupdate.$set = <any>{updatedAt: date};\n\t\t\t}\n\t\t\telse {\n\t\t\t\tupdate.$set.updatedAt = date;\n\t\t\t}\n\t\t}\n\n\t\tif (this.checkSchema && !bypassCheckSchema) {\n\t\t\tconst validation = this.simplschema.newContext();\n\t\t\tconst isValid = validation.validate(update, {modifier: true});\n\n\t\t\tif (!isValid) {\n\t\t\t\tconsole.log(new Date(), this.collectionName, 'Schema Errors - updateMany', validation.validationErrors());\n\t\t\t\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on updateMany - ' + this.collectionName, [validation.validationErrors(), update]);\n\t\t\t\tthrow validation.validationErrors();\n\t\t\t}\n\t\t}\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tif ((this.useVersions && !bypassVersions) || (this.createLogs && !bypassLogs)) {\n\t\t\tlet docs = await this.find(filter);\n\n\t\t\tfor (let i = 0; i < docs.length; i++) {\n\t\t\t\tlet doc = docs[i];\n\n\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t) {\n\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, update, safeOptions])) < 200000 ? JSON.stringify([doc, filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'updateMany',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, update, safeOptions])) < 200000 ? JSON.stringify([doc, filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\tmethod: 'updateMany',\n\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.useVersions) {\n\t\t\t\t\tlet versionDoc = deepCopy(doc);\n\t\t\t\t\tversionDoc._id = {_id: doc._id, __v: doc.__v};\n\n\t\t\t\t\tlet versionOptions = null;\n\t\t\t\t\tif (!sessionOptions) {\n\t\t\t\t\t\tversionOptions = {upsert: true};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tversionOptions = {session, upsert: true};\n\t\t\t\t\t}\n\t\n\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, versionOptions);\n\t\t\t\t\t\n\t\t\t\t\tif (doc.__v >= 4) {\n\t\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).deleteMany(<any>{$and: [{'_id._id': doc._id}, {'_id.__v': {$lt: doc.__v - 4}}]}, sessionOptions);\n\t\t\t\t\t}\n\t\n\t\t\t\t\tif (!objectContainsPropertyDeep(update, '__v')) {\n\t\t\t\t\t\tif (!update.$inc) {\n\t\t\t\t\t\t\tupdate.$inc = {__v: 1};\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (!update.$inc.__v) {\n\t\t\t\t\t\t\tupdate.$inc.__v = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tlet monitor = MonitorMongo.create('updateMany', this.collectionName, JSON.stringify([filter, update, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateMany(<any>filter, update, options);\n\t\t\tif (res.acknowledged) {\n\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t}\n\n\t\t\t\treturn res.modifiedCount;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new Error(`Error in updateMany: ${res}`);\n\t\t\t}\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Update Many', this.collectionName, filter, update, safeOptions, err);\n\t\t\terr.message = `Error in Update Many: ${this.collectionName} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync updateOne(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T>, update: MongoManagerUpdateFilter<T>, options?: UpdateOptions, bypassLogs = false, bypassCheckSchema = false, bypassSession = false) : Promise<number> {\n\t\tif (this.checkSchema && !bypassCheckSchema) {\n\t\t\tconst validation = this.simplschema.newContext();\t\t\t\n\t\t\tconst isValid = validation.validate(update, {modifier: true});\n\n\t\t\tif (!isValid) {\n\t\t\t\tconsole.log(new Date(), this.collectionName, 'Schema Errors - updateOne', validation.validationErrors());\n\t\t\t\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on updateOne - ' + this.collectionName, [validation.validationErrors(), update]);\n\t\t\t\tthrow validation.validationErrors();\n\t\t\t}\n\t\t}\n\n\t\tif ((!update.$inc || JSON.stringify(update.$inc) === '{}') && (!update.$set || JSON.stringify(update.$set) === '{}') && (!update.$setOnInsert || JSON.stringify(update.$setOnInsert) === '{}') && (!update.$unset || JSON.stringify(update.$unset) === '{}')) {\n\t\t\treturn 1;\n\t\t}\n\n\t\tlet date = new Date();\n\n\t\tif (this.timestamps) {\n\t\t\tif (!update.$set) {\n\t\t\t\tupdate.$set = <any>{updatedAt: date};\n\t\t\t}\n\t\t\telse {\n\t\t\t\tupdate.$set.updatedAt = date;\n\t\t\t}\n\t\t}\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\t\t\n\t\tif (this.useVersions) {\n\t\t\tlet doc = await this.findOne(filter, null, true);\n\n\t\t\tif (doc) {\n\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t) {\n\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, update, safeOptions])) < 200000 ? JSON.stringify([doc, filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'updateOne',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, update, safeOptions])) < 200000 ? JSON.stringify([doc, filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\tmethod: 'updateOne',\n\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tlet versionDoc = deepCopy(doc);\n\t\t\t\tversionDoc._id = {_id: doc._id, __v: doc.__v};\n\n\t\t\t\tlet versionOptions = null;\n\t\t\t\tif (!sessionOptions) {\n\t\t\t\t\tversionOptions = {upsert: true};\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tversionOptions = {session, upsert: true};\n\t\t\t\t}\n\n\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, versionOptions);\n\t\t\t\t\n\t\t\t\tif (doc.__v >= 4) {\n\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).deleteMany(<any>{$and: [{'_id._id': doc._id}, {'_id.__v': {$lt: doc.__v - 4}}]}, sessionOptions);\n\t\t\t\t}\n\n\t\t\t\tif (!objectContainsPropertyDeep(update, '__v')) {\n\t\t\t\t\tif (!update.$inc) {\n\t\t\t\t\t\tupdate.$inc = {__v: 1};\n\t\t\t\t\t}\n\t\t\t\t\telse if (!update.$inc.__v) {\n\t\t\t\t\t\tupdate.$inc.__v = 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tlet monitor = MonitorMongo.create('updateOne', this.collectionName, JSON.stringify([filter, update, safeOptions]));\n\n\t\t\t\ttry {\n\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateOne(<any>filter, update, options);\n\t\t\t\t\tif (res.acknowledged) {\n\t\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn res.modifiedCount;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tthrow new Error(`Error in Update One: ${this.collectionName} - ${JSON.stringify(res, null, 2)}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(new Date(), 'Error Update One', this.collectionName, filter, update, safeOptions, err);\n\t\t\t\t\terr.message = `Error in Update One: ${this.collectionName} - ${err.message}`;\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t\tfinally {\n\t\t\t\t\tawait monitor.finish();\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (options && options.upsert) {\n\t\t\t\tif (!update.$setOnInsert) {\n\t\t\t\t\tif (this.timestamps) {\n\t\t\t\t\t\tupdate.$setOnInsert = <any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t__v: 0,\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tupdate.$setOnInsert = <any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t__v: 0\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (!update.$setOnInsert._id) {\n\t\t\t\t\t\tupdate.$setOnInsert._id = objectIdHexString();\n\t\t\t\t\t}\n\n\t\t\t\t\tif (this.timestamps && !update.$setOnInsert.createdAt) {\n\t\t\t\t\t\tupdate.$setOnInsert.createdAt = new Date();\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t) {\n\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: update.$setOnInsert._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['upsert', filter, update, safeOptions])) < 200000 ? JSON.stringify(['upsert', filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'updateOne',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\tid_document: update.$setOnInsert._id,\n\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['upsert', filter, update, safeOptions])) < 200000 ? JSON.stringify(['upsert', filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\tmethod: 'updateOne',\n\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tlet monitor = MonitorMongo.create('updateOne', this.collectionName, JSON.stringify([filter, update, safeOptions]));\n\n\t\t\t\ttry {\n\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateOne(<any>filter, update, options);\n\t\t\t\t\tif (res.acknowledged) {\n\t\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn res.modifiedCount;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tthrow new Error(`Error in Update One: ${this.collectionName} - ${JSON.stringify(res, null, 2)}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(new Date(), 'Error Update One', this.collectionName, filter, update, safeOptions, err);\n\t\t\t\t\terr.message = `Error in Update One: ${this.collectionName} - ${err.message}`;\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t\tfinally {\n\t\t\t\t\tawait monitor.finish();\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new Error('Error in Update One: No Document');\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tif (options && options.upsert) {\n\t\t\t\tif (!update.$setOnInsert) {\n\t\t\t\t\tif (this.timestamps) {\n\t\t\t\t\t\tupdate.$setOnInsert = <any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tupdate.$setOnInsert = <any>{\n\t\t\t\t\t\t\t_id: objectIdHexString()\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (!update.$setOnInsert._id) {\n\t\t\t\t\t\tupdate.$setOnInsert._id = objectIdHexString();\n\t\t\t\t\t}\n\n\t\t\t\t\tif (this.timestamps && !update.$setOnInsert.createdAt) {\n\t\t\t\t\t\tupdate.$setOnInsert.createdAt = new Date();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\tif (!options) {\n\t\t\t\t\toptions = <FindOneAndUpdateOptions>{returnDocument: 'before'};\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t(<FindOneAndUpdateOptions>options).returnDocument = 'before';\n\t\t\t\t}\n\n\t\t\t\tlet monitor = MonitorMongo.create('findOneAndUpdate', this.collectionName, JSON.stringify([filter, update, safeOptions]));\n\n\t\t\t\ttry {\n\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).findOneAndUpdate(<any>filter, update, <FindOneAndUpdateOptions>options);\n\t\t\t\t\tlet doc = res.value;\n\n\t\t\t\t\tif (doc) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: <any>doc._id,\n\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, update, safeOptions])) < 200000 ? JSON.stringify([doc, filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: 'updateOne',\n\t\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: <any>doc._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, update, safeOptions])) < 200000 ? JSON.stringify([doc, filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'updateOne',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn res.ok;\n\t\t\t\t\t}\n\t\t\t\t\telse if (update.$setOnInsert) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: update.$setOnInsert._id,\n\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['upsert', filter, update, safeOptions])) < 200000 ? JSON.stringify(['upsert', filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: 'updateOne',\n\t\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: update.$setOnInsert._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['upsert', filter, update, safeOptions])) < 200000 ? JSON.stringify(['upsert', filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'updateOne',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn res.ok;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(new Date(), 'Error Update One (Find One And Update)', this.collectionName, filter, update, safeOptions, err);\n\t\t\t\t\terr.message = `Error in Update One (Find One And Update): ${this.collectionName} - ${err.message}`;\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t\tfinally {\n\t\t\t\t\tawait monitor.finish();\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tlet monitor = MonitorMongo.create('updateOne', this.collectionName, JSON.stringify([filter, update, safeOptions]));\n\n\t\t\t\ttry {\n\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateOne(<any>filter, update, options);\n\t\t\t\t\tif (res.acknowledged) {\n\t\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn res.modifiedCount;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tthrow new Error(`Error in Aggregate: ${this.collectionName} - ${JSON.stringify(res, null, 2)}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(new Date(), 'Error Update One', this.collectionName, filter, update, safeOptions, err);\n\t\t\t\t\terr.message = `Error in Aggregate: ${this.collectionName} - ${err.message}`;\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t\tfinally {\n\t\t\t\t\tawait monitor.finish();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t\n\twatchCollection(pipeline = [], options?: ChangeStreamOptions, bypassSession = false): ChangeStream<T> {\n\t\tconst session = ResolveIOServer.getMongoManager().getSession();\n\t\tif (session && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = session;\n\t\t\t}\n\t\t}\n\t\t\n\t\tlet stream = ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).watch(pipeline, options);\n\t\treturn <ChangeStream<T>>stream;\n\t}\n}\n\nexport class MongoManagerUserCollection<T extends CollectionDocument> extends MongoManagerCollection<T> {\n\tstatic create(options: MongoManagerCollectionOptions) {\n\t\tconst mongoManagerCollection = new MongoManagerUserCollection();\n\t\tmongoManagerCollection.initialize(options);\n\t\treturn mongoManagerCollection;\n\t}\n\t\n\tasync authenticate(user: UserModel, password: string): Promise<{data: UserModel, error: string}> {\n\t\tconst attemptsInterval = Math.pow(100, Math.log(user.attempts + 1));\n\t\tconst calculatedInterval = attemptsInterval < 300000 ? attemptsInterval : 300000;\n\t\n\t\tif (user.last) {\n\t\t\tif (Date.now() - user.last.getTime() < calculatedInterval) {\n\t\t\t\tuser.last = new Date();\n\t\t\t\tawait Users.updateOne({_id: user._id}, {$set: {last: user.last}});\n\t\t\t\treturn {\n\t\t\t\t\tdata: null,\n\t\t\t\t\terror: 'Attempt Too Soon'\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tuser.last = new Date();\n\t\t}\n\t\n\t\tif (user.attempts >= 5) {\n\t\t\treturn {\n\t\t\t\tdata: null,\n\t\t\t\terror: 'Too Many Attempts'\n\t\t\t};\n\t\t}\n\t\t\n\t\tif (!user.salt) {\n\t\t\treturn {\n\t\t\t\tdata: null,\n\t\t\t\terror: 'No Salt Value Stored'\n\t\t\t};\n\t\t}\n\n\t\ttry {\n\t\t\tlet hashBuffer = await pbkdf2Promisified(password, user.salt, {\n\t\t\t\titerations: 25000,\n\t\t\t\tkeylen: 512,\n\t\t\t\tdigestAlgorithm: 'sha256'\n\t\t\t});\n\n\t\t\tif (scmp(hashBuffer, Buffer.from(user.hash, 'hex'))) {\n\t\t\t\tuser.last = new Date();\n\t\t\t\tuser.attempts = 0;\n\t\t\t\tawait Users.updateOne({_id: user._id}, {$set: {last: user.last, attempts: user.attempts}});\n\n\t\t\t\treturn {\n\t\t\t\t\tdata: user,\n\t\t\t\t\terror: ''\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\tuser.last = new Date();\n\t\t\t\tuser.attempts = user.attempts + 1;\n\t\t\t\tawait Users.updateOne({_id: user._id}, {$set: {last: user.last, attempts: user.attempts}});\n\n\t\t\t\tif (user.attempts >= 5) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdata: null,\n\t\t\t\t\t\terror: 'Too Many Attempts'\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdata: null,\n\t\t\t\t\t\terror: 'Invalid Username And Password'\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tcatch (err) {\n\t\t\terr.message = `Error in User Authenticate: ${JSON.stringify(user, null, 2)} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t}\n\n\tserializeUser() {\n\t\treturn (user, cb) => {\n\t\t\tcb(null, user.username);\n\t\t};\n\t}\n\n\tdeserializeUser() {\n\t\treturn async (username) => {\n\t\t\treturn Users.findOne({username: username});\n\t\t};\n\t}\n\n\tasync setPassword(user: UserModel, password: string) {\n\t\tif (!user) {\n\t\t\tthrow new Error('Error In User Set Password: No User');\n\t\t}\n\t\telse if (!password) {\n\t\t\tthrow new Error('Error In User Set Password: No Password');\n\t\t}\n\t\telse {\n\t\t\tlet saltBuffer = await randomBytes(32);\n\t\t\tlet salt = saltBuffer.toString('hex');\n\t\t\ttry {\n\t\t\t\tlet hashRaw = await pbkdf2Promisified(password, salt, {\n\t\t\t\t\titerations: 25000,\n\t\t\t\t\tkeylen: 512,\n\t\t\t\t\tdigestAlgorithm: 'sha256'\n\t\t\t\t});\n\t\t\t\tlet hash = Buffer.from(hashRaw, 'binary').toString('hex');\n\t\t\t\t\n\t\t\t\treturn Users.updateOne({_id: user._id}, {$set: {hash: hash, salt: salt, services: {}, attempts: 0}});\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\terr.message = `Error in User Set Password: ${JSON.stringify(user, null, 2)} - ${err.message}`;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t}\n\t};\n\n\tasync changePassword(user, oldPassword, newPassword) {\n\t\tif (!user) {\n\t\t\tthrow new Error('Error in User Change Password: Missing User');\n\t\t}\n\t\telse if (!oldPassword || !newPassword) {\n\t\t\tthrow new Error('Error in User Change Password: Missing Password');\n\t\t}\n\t\telse {\n\t\t\tlet authUser = await this.authenticate(user, oldPassword);\n\n\t\t\tif (!authUser['data']) {\n\t\t\t\tthrow authUser['error'];\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn this.setPassword(user, newPassword);\n\t\t\t}\n\t\t}\n\t}\n\t\n\tasync register(user, password) {\n\t\tif (!user.username) {\n\t\t\tthrow new Error('Error in User Register: Missing Username');\n\t\t}\n\t\telse {\n\t\t\tlet dbUser = await Users.findOne({username: user.username});\n\t\t\t\n\t\t\tif (dbUser) {\n\t\t\t\tthrow new Error('Error in User Register: Username Exists');\n\t\t\t}\n\t\t\telse {\n\t\t\t\tdbUser = await Users.findOne({email: user.email});\n\n\t\t\t\tif (dbUser) {\n\t\t\t\t\tthrow new Error('Error in User Register: Email Exists');\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tuser.setPassword(password);\n\t\t\t\t\treturn user;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tresetAttempts(user: UserModel) {\n\t\treturn Users.updateOne({_id: user._id}, {$set: {attempts: 0}});\n\t}\n}\n\nfunction pbkdf2(password, salt, options, callback) {\n\tcrypto.pbkdf2(password, salt, options.iterations, options.keylen, options.digestAlgorithm, callback);\n};\n\nfunction pbkdf2Promisified(password, salt, options): Promise<any> {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn new Promise((resolve, reject) => pbkdf2(password, salt, options, (err, hashRaw) => (err ? reject(err) : resolve(hashRaw))));\n}\n\nfunction randomBytes(saltlen): Promise<Buffer> {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn new Promise((resolve, reject) => crypto.randomBytes(saltlen, (err, saltBuffer) => (err ? reject(err) : resolve(saltBuffer))));\n}\n\nfunction objectContainsPropertyDeep(obj: Object, prop: string) {\n\tlet keys = Object.keys(obj);\n\n\tif (keys.some(a => a === prop)) {\n\t\treturn true;\n\t}\n\t\n\tfor (let i = 0; i < keys.length; i++) {\n\t\tlet key = keys[i];\n\t\tif (obj[key] && typeof obj[key] === 'object' && objectContainsPropertyDeep(obj[key], prop)) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}"]}
|
|
1
|
+
{"version":3,"sources":["../../src/managers/mongo.manager.ts"],"names":["async_1","require","NodeCache","os_1","simpl_schema_1","user_collection_1","resolveio_server_app_1","common_1","monitor_manager_1","crypto","scmp","numCPUs","cpus","length","v8","AsyncLocalStorage","asyncLocalStorage","MongoManager","this","_collections","_cacheMap","_operationInProgress","Map","_heapSize","getHeapStatistics","_serverCollections","_isWorkersEnabled","_isWorkerInstance","create","mongoManager","initialize","_a","sent","prototype","_nodeCache","stdTTL","checkperiod","process","env","IS_WORKERS_ENABLED","IS_WORKER_INSTANCE","setCacheLimit","setupChangeStream","ResolveIOServer","getMainDB","listCollections","toArray","collections","oneTimeTransaction","fn","_this","run","__awaiter","session","getMongoConnection","startSession","getStore","withTransaction","result_1","endSession","store","getSession","_heapLimit","getServerCollections","registerCollection","collection","collectionOptions","timeseries","timeField","some","a","name","collectionName","type","dropCollection","createCollection","push","find","delay","ms","Promise","resolve","setTimeout","filter","options","safeOptions","__rest","cacheKey","generateCacheKey","undefined","result","getFromCache","getMainServer","getSubscriptionManager","getEnableDebug","console","log","Date","has","get","promise","operation","executeFind","set","invalidatedDuringExecution","finally","delete","_b","monitor","MonitorMongo","JSON","stringify","message","concat","err_1","finish","addToCache","findOne","executeFindOne","err_2","aggregate","pipeline","__spreadArray","__read","flatMap","stage","$lookup","from","executeAggregate","err_3","countDocuments","executeCountDocuments","err_4","functionName","args","keyString","createHash","update","digest","cachedData","parse","dateReviver","del","data","getBinarySize","includes","endsWith","startsWith","nodeCacheSize","getStats","vsize","deleteCount","keys","keys_1","__values","keys_1_1","next","done","key","value","invalidateQueryCache","collectionCacheMap","collectionCacheMap_1","collectionCacheMap_1_1","cacheMap","_c","entries","_d","_e","changeStream","watch","$match","$and","ns.coll","$nin","$not","fullDocument","on","change","coll","close","MongoManagerModel","exports","collection_main","collection_version","mongoManagerModel","versionOptions","MongoManagerUserCollection","MongoManagerCollection","useVersionCollection","useVersions","versionSchema","deepCopy","schema","_id","blackbox","useReportBuilder","reportBuilderLookupTables","timestamps","createLogs","checkSchema","skipCache","setImmediate","createIndex","_id._id","_id.__v","versionCollection","simplschema","rbSchema","useRB","bypassSession","mongoManagerCollection","schemaCopy","interval","default","buildRbLookups","buildRbSchema","setInterval","getMongoManager","clearInterval","extractIndexNameFromError","errorMessage","matches","match","mongoSession","err_5","aggregateCount","err_6","aggregateCursor","cursor","ev","aggregateStream","streamOptions","stream","bulkWrite","operations","bypassCheckSchema","bypassLogs","bypassVersions","BATCH_SIZE","opIndex","sessionOptions","batchOps","slice","logs","versionOps","e_5","batchOps_1","batchOps_1_1","op","opType","Object","doc","validationContext","newContext","isValid","validate","document","replacement","modifier","Error","validationErrors","createdAt","updatedAt","insertOne","objectIdHexString","id_document","payload","method","id_user","user","messageId","route","versionDoc","__assign","__v","$set","$inc","affectedDocs","versionFilters","map","v","$or","versionInserts","bwOptions","ordered","error","e_4","err_7","getServerConfig","getLocalLogManager","writeLogs","affectedDocIds","$in","$sort","$group","versions","$push","$project","versionsToDelete","$slice","$size","$unwind","$replaceRoot","newRoot","oldVersions","deleteMany","error_1","ok","estimatedDocumentCount","err_8","f_docs","Array","isArray","insertMany","fieldOrSpec","indexes","existingIndexes","index","indexQueue","action","specs","createIndexes","indexSpecs","existingIndexes_1","indexesToCreate","indexSpec","existingIndex","docs","i","writeLog","upsert","replaceOne","$lt","res","acknowledged","deletedCount","err_11","deleteOne","findOneAndDelete","returnVal","err_12","err_13","distinct","err_14","drop","err_15","dropIndex","indexName","err_16","dropIndexes","err_17","err_18","findById","id","err_19","findCount","count","err_20","findCursor","removeAllListeners","findStream","err_21","err_22","findOneAndReplace","validation","getMethodManager","callMethod","call","date","err_23","findOneAndUpdate","$setOnInsert","err_24","err_25","indexExists","err_26","bypassMonitor","validationResults","forEach","validDocs","idx","hasOwnProperty","err_27","err_28","listIndexes","rename","newName","err_29","modifiedCount","err_30","prevDoc","docId","docVersion","updatedDoc","getMongoMergeUpdatedDoc","err_31","err_32","returnDocument","safeOptions_1","doc_1","err_33","err_34","updateMany","$unset","objectContainsPropertyDeep","err_35","updateOne","err_36","err_37","err_38","err_39","watchCollection","queue","task","callback","dbCollection","apply","code","err_40","existingIndexName","innerError_1","_super","__extends","authenticate","password","attemptsInterval","Math","pow","attempts","calculatedInterval","last","now","getTime","Users","salt","pbkdf2Promisified","iterations","keylen","digestAlgorithm","hashBuffer","Buffer","hash","err_41","serializeUser","cb","username","deserializeUser","setPassword","randomBytes","saltBuffer","toString","hashRaw","services","err_42","changePassword","oldPassword","newPassword","authUser","register","email","resetAttempts","pbkdf2","reject","err","saltlen","obj","prop"],"mappings":"02GAAAA,S,+KAAAC,QAAA,OAAA,GAEAC,UAAAD,QAAA,YAAA,EACAE,KAAAF,QAAA,IAAA,EACAG,eAAAH,QAAA,cAAA,EACAI,kBAAAJ,QAAA,gCAAA,EAIAK,uBAAAL,QAAA,yBAAA,EACAM,SAAAN,QAAA,gBAAA,EACAO,kBAAAP,QAAA,mBAAA,EACMQ,OAASR,QAAQ,QAAQ,EACzBS,KAAOT,QAAQ,MAAM,EACrBU,SAAU,EAAAR,KAAAS,MAAI,EAAGC,OACjBC,GAAKb,QAAQ,IAAI,EACfc,kBAAsBd,QAAQ,aAAa,EAACc,kBAC9CC,kBAAoB,IAAID,kBAwF9BE,aAAA,WAWC,SAAAA,eAVQC,KAAAC,aAA6D,G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,SAASqB,kBAAkBX,EAAUU,EAAM/V,GAE1C,OAAO,IAAIJ,QAAQ,SAACC,EAAS8X,GAAW,OAAAD,OAAOrC,EAAUU,EAAM/V,EAAS,SAAC4X,EAAKZ,GAAY,OAACY,EAAMD,EAAOC,CAAG,EAAI/X,EAAQmX,CAAO,CAApC,CAAsC,CAAxF,CAAyF,CAClI,CAEA,SAASH,YAAYgB,GAEpB,OAAO,IAAIjY,QAAQ,SAACC,EAAS8X,GAAW,OAAAtc,OAAOwb,YAAYgB,EAAS,SAACD,EAAKd,GAAe,OAACc,EAAMD,EAAOC,CAAG,EAAI/X,EAAQiX,CAAU,CAAvC,CAAyC,CAA1F,CAA2F,CACpI,CAEA,SAAS7C,2BAA2B6D,EAAaC,GAChD,IAAI3T,EAAOmG,OAAOnG,KAAK0T,CAAG,EAE1B,GAAI1T,EAAKnF,KAAK,SAAAC,GAAK,OAAAA,IAAM6Y,CAAN,CAAU,EAC5B,MAAO,CAAA,EAGR,IAAK,IAAI1I,EAAI,EAAGA,EAAIjL,EAAK3I,OAAQ4T,CAAC,GAAI,CACrC,IAAI3K,EAAMN,EAAKiL,GACf,GAAIyI,EAAIpT,IAA4B,UAApB,OAAOoT,EAAIpT,IAAqBuP,2BAA2B6D,EAAIpT,GAAMqT,CAAI,EACxF,MAAO,CAAA,C,CAIT,MAAO,CAAA,CACR,CArMa7R,QAAAK,2BAAAA","file":"mongo.manager.js","sourcesContent":["import async from 'async';\nimport { AggregateOptions, AggregationCursor, BulkWriteOptions, BulkWriteResult, ChangeStream, ChangeStreamOptions, Collection, CollectionInfo, CommandOperationOptions, CountDocumentsOptions, CreateCollectionOptions, CreateIndexesOptions, CursorStreamOptions, DeleteOptions, FindCursor, FindOneAndDeleteOptions, FindOneAndReplaceOptions, FindOneAndUpdateOptions, FindOptions, IndexDescription, IndexInformationOptions, InsertOneOptions, ListIndexesCursor, ListIndexesOptions, OptionalUnlessRequiredId, RenameOptions, ReplaceOptions, UpdateOptions } from 'mongodb';\nimport * as NodeCache from 'node-cache';\nimport { cpus } from 'os';\nimport SimpleSchema from 'simpl-schema';\nimport { Users } from '../collections/user.collection';\nimport { CollectionDocument, Document } from '../models/collection-document.model';\nimport { LookupTables } from '../models/report-builder.model';\nimport { UserModel } from '../models/user.model';\nimport { ResolveIOServer } from '../resolveio-server-app';\nimport { buildRbLookups, buildRbSchema, dateReviver, deepCopy, getBinarySize, getMongoMergeUpdatedDoc, objectIdHexString } from '../util/common';\nimport { MonitorMongo } from './monitor.manager';\nconst crypto = require('crypto');\nconst scmp = require('scmp');\nconst numCPUs = cpus().length;\nconst v8 = require('v8');\nconst { AsyncLocalStorage } = require('async_hooks');\nconst asyncLocalStorage = new AsyncLocalStorage();\n\n// export declare interface MongoManagerFilterOperators<T> extends Document {\nexport declare interface MongoManagerFilterParamaterOperators<P> {\n\t$eq?: P;\n\t$gt?: P;\n\t$gte?: P;\n\t$in?: P extends Array<any> ? P : P[];\n\t$lt?: P;\n\t$lte?: P;\n\t$ne?: P;\n\t$nin?: P extends Array<any> ? P : P[];\n\t$not?: P extends string ? MongoManagerFilterParamaterOperators<P> | RegExpConstructor : MongoManagerFilterParamaterOperators<P>;\n\t$exists?: boolean;\n\t$expr?: any[]\n\t$regex?: P extends string ? RegExpConstructor | string : never;\n\t$options?: P extends string ? string : never;\n\t$geoIntersects?: {\n\t\t$geometry: Document;\n\t};\n\t$geoWithin?: Document;\n\t$near?: Document;\n\t$nearSphere?: Document;\n\t$maxDistance?: number;\n\t$all?: any[];\n\t$elemMatch?: Document;\n\t$size?: P extends any[] ? number : never;\n}\n\nexport declare interface MongoManagerFilterOperators<T> extends Document { //TODO: Remove extends document when I get answer on S.O.\n\t$and?: MongoManagerFilter<T>[] | MongoManagerFilterOperators<T>;\n\t$nor?: MongoManagerFilter<T>[] | MongoManagerFilterOperators<T>;\n\t$or?: MongoManagerFilter<T>[] | MongoManagerFilterOperators<T>;\n\t$text?: {\n\t\t$search: string;\n\t\t$language?: string;\n\t\t$caseSensitive?: boolean;\n\t\t$diacriticSensitive?: boolean;\n\t};\n\t// eslint-disable-next-line no-unused-vars\n\t$where?: string | ((this: T) => boolean);\n\t$comment?: string | Document;\n}\n\n// function isDotStringRegExp(obj: Object, dotKey: string): boolean {\n// \tlet keyData = dotKey.split('.');\n// \tlet objData = obj;\n\t\n// \tfor (let i = 0; i < keyData.length; i++) {\n// \t\tlet key = keyData[i];\n// \t\tif (objData.hasOwnProperty(key)) {\n// \t\t\tobjData = objData[key];\n\t\t\t\n// \t\t\tif (i === keyData.length - 1) {\n// \t\t\t\treturn true;\n// \t\t\t}\n// \t\t}\n// \t\telse {\n// \t\t\treturn false;\n// \t\t}\n// \t}\n// }\n\n// export declare type MongoManagerDotStringFilter<T> = {\n// \t[key: string]: (isDotStringRegExp(T, key) ? any : never);\n// };\n\nexport declare type MongoManagerFilter<T> = {\n\t[P in keyof T]?: T[P] | MongoManagerFilterParamaterOperators<T[P]>;\n};\n\nexport declare type MongoManagerUnsetFilter<T> = {\n\t// eslint-disable-next-line no-unused-vars\n\t[P in keyof T]?: number | boolean;\n};\n\nexport declare type MongoManagerIncFilter<T> = {\n\t// eslint-disable-next-line no-unused-vars\n\t[P in keyof T]?: number;\n};\n\nexport declare type MongoManagerUpdateFilter<T> = {\n\t$inc?: MongoManagerIncFilter<T> | Document;\n\t$set?: MongoManagerFilter<T> | Document;\n\t$setOnInsert?: MongoManagerFilter<T> | Document;\n\t$unset?: MongoManagerUnsetFilter<T> | Document;\n};\n\nexport class MongoManager {\n\tprivate _collections: MongoManagerCollection<CollectionDocument>[] = [];\n\tprivate _nodeCache;\n\tprivate _cacheMap: { collections: string[], key: string }[] = [];\n\tprivate _operationInProgress: Map<string, { promise: Promise<any>, invalidatedDuringExecution: boolean, collections: string[] }> = new Map();\n\tprivate _heapSize = v8.getHeapStatistics() / numCPUs;\n\tprivate _heapLimit: number;\n\tprivate _serverCollections: (CollectionInfo | Pick<CollectionInfo, 'name' | 'type'>)[] = [];\n\tprivate _isWorkersEnabled = false;\n\tprivate _isWorkerInstance = false;\n\n\tconstructor() {}\n\n\tstatic async create() {\n\t\tconst mongoManager = new MongoManager();\n\t\tawait mongoManager.initialize();\n\t\treturn mongoManager;\n\t}\n\n\tprivate async initialize() {\n\t\tthis._nodeCache = new NodeCache({ stdTTL: 0, checkperiod: 0 });\n\n\t\tthis._isWorkersEnabled = process.env.IS_WORKERS_ENABLED === 'true';\n\t\tthis._isWorkerInstance = process.env.IS_WORKER_INSTANCE === 'true';\n\t\tthis.setCacheLimit();\n\n\t\tif (this._isWorkersEnabled && this._isWorkerInstance) {\n\t\t\tthis.setupChangeStream();\n\t\t}\n\n\t\tlet collections = await ResolveIOServer.getMainDB().listCollections().toArray();\n\t\tthis._serverCollections = collections;\n\t}\n\n\toneTimeTransaction<T>(fn: () => Promise<T>): Promise<T> {\n\t\treturn asyncLocalStorage.run({}, async () => {\n\t\t\tconst session = ResolveIOServer.getMongoConnection().startSession();\n\t\t\tasyncLocalStorage.getStore().session = session;\n\t\n\t\t\ttry {\n\t\t\t\tlet result: T;\n\t\t\t\t\n\t\t\t\tawait session.withTransaction(async () => {\n\t\t\t\t\t// Directly assign the result from fn()\n\t\t\t\t\tresult = await fn();\n\t\t\t\t\treturn result; // Explicit return for transaction validation\n\t\t\t\t});\n\t\n\t\t\t\treturn result; // Transaction committed successfully\n\t\t\t} \n\t\t\tfinally {\n\t\t\t\tawait session.endSession();\n\t\t\t\tconst store = asyncLocalStorage.getStore();\n\t\t\t\tif (store) delete store.session;\n\t\t\t}\n\t\t});\n\t}\n\t\n\tgetSession() {\n\t\tconst store = asyncLocalStorage.getStore();\n\t\treturn store ? store.session : null;\n\t}\n\n\tprivate setCacheLimit() {\n\t\tif (this._isWorkersEnabled) {\n\t\t\tthis._heapLimit = this._isWorkerInstance ? this._heapSize * 0.8 : this._heapSize * 0.4;\n\t\t}\n\t\telse {\n\t\t\tthis._heapLimit = this._heapSize * 0.3;\n\t\t}\n\t}\n\n\tgetServerCollections() {\n\t\treturn this._serverCollections;\n\t}\n\n\tasync registerCollection(collection: MongoManagerCollection<CollectionDocument>) {\n\t\tif (\n\t\t\tcollection.collectionOptions &&\n\t\t\tcollection.collectionOptions.timeseries &&\n\t\t\tcollection.collectionOptions.timeseries.timeField &&\n\t\t\tthis._serverCollections.some(a => a.name === collection.collectionName && a.type === 'collection')\n\t\t) {\n\t\t\tawait ResolveIOServer.getMainDB().dropCollection(collection.collectionName);\n\t\t\tawait this.createCollection(collection);\n\t\t}\n\n\t\tthis._collections.push(collection);\n\t}\n\n\tasync createCollection(collection: MongoManagerCollection<CollectionDocument>) {\n\t\tawait ResolveIOServer.getMainDB().createCollection(collection.collectionName, collection.collectionOptions);\n\t}\n\n\tcollections() {\n\t\treturn this._collections;\n\t}\n\n\tcollection(collectionName: string): MongoManagerCollection<CollectionDocument> | MongoManagerUserCollection<CollectionDocument> {\n\t\treturn this._collections.find(a => a.collectionName === collectionName);\n\t}\n\n\tprivate async delay(ms: number) {\n\t\t// eslint-disable-next-line no-restricted-syntax\n\t\treturn new Promise(resolve => setTimeout(resolve, ms));\n\t}\n\n\tpublic async find<T extends CollectionDocument>(\n\t\tcollectionName: string,\n\t\tfilter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {},\n\t\toptions?: FindOptions<T>\n\t): Promise<T[]> {\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\t\tconst cacheKey = this.generateCacheKey([collectionName], 'find', [filter, safeOptions]);\n\t\tlet result = this.getFromCache(cacheKey);\n\t\tif (result !== undefined) {\n\t\t\tif (ResolveIOServer.getMainServer().getSubscriptionManager() && ResolveIOServer.getMainServer().getSubscriptionManager().getEnableDebug()) {\n\t\t\t\tconsole.log(new Date(), 'Mongo Find - Cache', collectionName);\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\tif (this._operationInProgress.has(cacheKey)) {\n\t\t\tif (ResolveIOServer.getMainServer().getSubscriptionManager() && ResolveIOServer.getMainServer().getSubscriptionManager().getEnableDebug()) {\n\t\t\t\tconsole.log(new Date(), 'Mongo Find - Already running', collectionName);\n\t\t\t}\n\t\t\treturn this._operationInProgress.get(cacheKey).promise;\n\t\t}\n\n\t\tif (ResolveIOServer.getMainServer().getSubscriptionManager() && ResolveIOServer.getMainServer().getSubscriptionManager().getEnableDebug()) {\n\t\t\tconsole.log(new Date(), 'Mongo Find - Running', collectionName);\n\t\t}\n\n\t\tconst operation = this.executeFind<T>(collectionName, filter, options, cacheKey);\n\t\tthis._operationInProgress.set(cacheKey, { \n\t\t\tpromise: operation, \n\t\t\tinvalidatedDuringExecution: false,\n\t\t\tcollections: [collectionName]\n\t\t});\n\n\t\tawait operation.finally(() => {\n\t\t\tif (ResolveIOServer.getMainServer().getSubscriptionManager() && ResolveIOServer.getMainServer().getSubscriptionManager().getEnableDebug()) {\n\t\t\t\tconsole.log(new Date(), 'Mongo Find - Done', collectionName);\n\t\t\t}\n\n\t\t\tthis._operationInProgress.delete(cacheKey);\n\t\t});\n\n\t\treturn operation;\n\t}\n\n\tprivate async executeFind<T extends CollectionDocument>(\n\t\tcollectionName: string,\n\t\tfilter: MongoManagerFilter<T> & MongoManagerFilterOperators<T>,\n\t\toptions: FindOptions<T> | undefined,\n\t\tcacheKey: string\n\t): Promise<T[]> {\n\t\tlet result;\n\t\tconst collection = ResolveIOServer.getMainDB().collection(collectionName);\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\t\tconst monitor = MonitorMongo.create('find', collectionName, JSON.stringify([filter, safeOptions]));\n\n\t\ttry {\n\t\t\tresult = await collection.find<T>(<any>filter, options).toArray();\n\t\t}\n\t\tcatch (err) {\n\t\t\terr.message = `Error in Execute Find (${collectionName}): ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t\n\t\tif (!this._operationInProgress.get(cacheKey).invalidatedDuringExecution) {\n\t\t\tthis.addToCache([collectionName], cacheKey, result);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t// FindOne Operation\n\tpublic async findOne<T extends CollectionDocument>(\n\t\tcollectionName: string,\n\t\tfilter: MongoManagerFilter<T> | MongoManagerFilterOperators<T> = {},\n\t\toptions?: FindOptions<T>\n\t): Promise<T> {\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\t\tconst cacheKey = this.generateCacheKey([collectionName], 'findOne', [filter, safeOptions]);\n\t\tlet result = this.getFromCache(cacheKey);\n\t\tif (result !== undefined) {\n\t\t\tif (ResolveIOServer.getMainServer().getSubscriptionManager() && ResolveIOServer.getMainServer().getSubscriptionManager().getEnableDebug()) {\n\t\t\t\tconsole.log(new Date(), 'Mongo FindOne - Cache', collectionName);\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}\n\n\t\tif (this._operationInProgress.has(cacheKey)) {\n\t\t\tif (ResolveIOServer.getMainServer().getSubscriptionManager() && ResolveIOServer.getMainServer().getSubscriptionManager().getEnableDebug()) {\n\t\t\t\tconsole.log(new Date(), 'Mongo FindOne - Already running', collectionName);\n\t\t\t}\n\n\t\t\treturn this._operationInProgress.get(cacheKey).promise;\n\t\t}\n\n\t\tif (ResolveIOServer.getMainServer().getSubscriptionManager() && ResolveIOServer.getMainServer().getSubscriptionManager().getEnableDebug()) {\n\t\t\tconsole.log(new Date(), 'Mongo FindOne - Running', collectionName);\n\t\t}\n\n\t\tconst operation = this.executeFindOne<T>(collectionName, filter, options, cacheKey);\n\t\tthis._operationInProgress.set(cacheKey, { \n\t\t\tpromise: operation, \n\t\t\tinvalidatedDuringExecution: false,\n\t\t\tcollections: [collectionName]\n\t\t});\n\n\t\tawait operation.finally(() => {\n\t\t\tif (ResolveIOServer.getMainServer().getSubscriptionManager() && ResolveIOServer.getMainServer().getSubscriptionManager().getEnableDebug()) {\n\t\t\t\tconsole.log(new Date(), 'Mongo FindOne - Done', collectionName);\n\t\t\t}\n\n\t\t\tthis._operationInProgress.delete(cacheKey);\n\t\t});\n\n\t\treturn operation;\n\t}\n\n\tprivate async executeFindOne<T extends CollectionDocument>(\n\t\tcollectionName: string,\n\t\tfilter: MongoManagerFilter<T> | MongoManagerFilterOperators<T>,\n\t\toptions: FindOptions<T> | undefined,\n\t\tcacheKey: string\n\t): Promise<T> {\n\t\tlet result;\n\t\tconst collection = ResolveIOServer.getMainDB().collection(collectionName);\n\t\t\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\t\tconst monitor = MonitorMongo.create('findOne', collectionName, JSON.stringify([filter, safeOptions]));\n\n\t\ttry {\n\t\t\tresult = await collection.findOne<T>(<any>filter, options);\n\t\t}\n\t\tcatch (err) {\n\t\t\terr.message = `Error in Execute Find One (${collectionName}): ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t\n\t\tif (!this._operationInProgress.get(cacheKey).invalidatedDuringExecution) {\n\t\t\tthis.addToCache([collectionName], cacheKey, result);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t// Aggregate Operation\n\tpublic async aggregate<T extends CollectionDocument>(\n\t\tcollectionName: string,\n\t\tpipeline: any[],\n\t\toptions?: AggregateOptions\n\t): Promise<any[]> {\n\t\tconst collections = [collectionName, ...pipeline.flatMap(stage => stage.$lookup?.from ? [stage.$lookup.from] : [])];\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\t\tconst cacheKey = this.generateCacheKey(collections, 'aggregate', [pipeline, safeOptions]);\n\t\tlet result = this.getFromCache(cacheKey);\n\t\tif (result !== undefined) {\n\t\t\tif (ResolveIOServer.getMainServer().getSubscriptionManager() && ResolveIOServer.getMainServer().getSubscriptionManager().getEnableDebug()) {\n\t\t\t\tconsole.log(new Date(), 'Mongo Agg - Cache', collections);\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\tif (this._operationInProgress.has(cacheKey)) {\n\t\t\tif (ResolveIOServer.getMainServer().getSubscriptionManager() && ResolveIOServer.getMainServer().getSubscriptionManager().getEnableDebug()) {\n\t\t\t\tconsole.log(new Date(), 'Mongo Agg - Already running', collections);\n\t\t\t}\n\n\t\t\treturn this._operationInProgress.get(cacheKey).promise;\n\t\t}\n\n\t\tif (ResolveIOServer.getMainServer().getSubscriptionManager() && ResolveIOServer.getMainServer().getSubscriptionManager().getEnableDebug()) {\n\t\t\tconsole.log(new Date(), 'Mongo Agg - Running', collections);\n\t\t}\n\n\t\tconst operation = this.executeAggregate<T>(collectionName, pipeline, options, cacheKey, collections);\n\t\tthis._operationInProgress.set(cacheKey, { \n\t\t\tpromise: operation, \n\t\t\tinvalidatedDuringExecution: false,\n\t\t\tcollections: collections\n\t\t});\n\n\t\tawait operation.finally(() => {\n\t\t\tif (ResolveIOServer.getMainServer().getSubscriptionManager() && ResolveIOServer.getMainServer().getSubscriptionManager().getEnableDebug()) {\n\t\t\t\tconsole.log(new Date(), 'Mongo Agg - Done', collections);\n\t\t\t}\n\n\t\t\tthis._operationInProgress.delete(cacheKey);\n\t\t});\n\n\t\treturn operation;\n\t}\n\n\tprivate async executeAggregate<T extends CollectionDocument>(\n\t\tcollectionName: string,\n\t\tpipeline: any[],\n\t\toptions: AggregateOptions | undefined,\n\t\tcacheKey: string,\n\t\tcollections: string[]\n\t): Promise<any[]> {\n\t\tlet result;\n\t\tconst collection = ResolveIOServer.getMainDB().collection(collectionName);\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\t\tconst monitor = MonitorMongo.create('aggregate', collectionName, JSON.stringify([pipeline, safeOptions]));\n\n\t\ttry {\n\t\t\tresult = await collection.aggregate<T>(pipeline, options).toArray();\n\t\t}\n\t\tcatch (err) {\n\t\t\terr.message = `Error in Execute Aggregate (${collectionName}): ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\n\t\tif (!this._operationInProgress.get(cacheKey).invalidatedDuringExecution) {\n\t\t\tthis.addToCache(collections, cacheKey, result);\n\t\t}\n\t\t\n\t\treturn result;\n\t}\n\n\tpublic async countDocuments<T extends CollectionDocument>(\n\t\tcollectionName: string,\n\t\tfilter: MongoManagerFilter<T> | MongoManagerFilterOperators<T> = {},\n\t\toptions?: CountDocumentsOptions\n\t): Promise<number> {\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\t\tconst cacheKey = this.generateCacheKey([collectionName], 'countDocuments', [filter, safeOptions]);\n\t\tlet result = this.getFromCache(cacheKey);\n\t\tif (result !== undefined) {\n\t\t\treturn result;\n\t\t}\n\n\t\tif (this._operationInProgress.has(cacheKey)) {\n\t\t\treturn this._operationInProgress.get(cacheKey).promise;\n\t\t}\n\n\t\tconst operation = this.executeCountDocuments<T>(collectionName, filter, options, cacheKey);\n\t\tthis._operationInProgress.set(cacheKey, { \n\t\t\tpromise: operation, \n\t\t\tinvalidatedDuringExecution: false,\n\t\t\tcollections: [collectionName]\n\t\t});\n\n\t\tawait operation.finally(() => this._operationInProgress.delete(cacheKey));\n\n\t\treturn operation;\n\t}\n\n\tprivate async executeCountDocuments<T extends CollectionDocument>(\n\t\tcollectionName: string,\n\t\tfilter: MongoManagerFilter<T> | MongoManagerFilterOperators<T>,\n\t\toptions: CountDocumentsOptions,\n\t\tcacheKey: string\n\t): Promise<number> {\n\t\tlet result;\n\t\tconst collection = ResolveIOServer.getMainDB().collection(collectionName);\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\t\tconst monitor = MonitorMongo.create('countDocuments', collectionName, JSON.stringify([filter, safeOptions]));\n\n\t\ttry {\n\t\t\tresult = await collection.countDocuments(<any>filter, options);\n\t\t}\n\t\tcatch (err) {\n\t\t\terr.message = `Error in Execute Count Documents (${collectionName}): ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t\n\t\tif (!this._operationInProgress.get(cacheKey).invalidatedDuringExecution) {\n\t\t\tthis.addToCache([collectionName], cacheKey, result);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t// Cache and Invalidation Setup\n\tprivate generateCacheKey(collections: string[], functionName: string, args: any[]): string {\n\t\tconst keyString = JSON.stringify({ collections, functionName, args });\n\t\treturn crypto.createHash('sha256').update(keyString).digest('hex');\n\t}\n\n\tprivate getFromCache(cacheKey: string): any | undefined {\n\t\ttry {\n\t\t\tconst cachedData = this._nodeCache.get(cacheKey);\n\t\t\tif (cachedData) {\n\t\t\t\treturn JSON.parse(cachedData, dateReviver);\n\t\t\t}\n\t\t} catch {\n\t\t\tthis._nodeCache.del(cacheKey);\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate addToCache(collections: string[], cacheKey: string, data: any) {\n\t\tif (getBinarySize(JSON.stringify(data)) < 1000000 && \n\t\t\t!collections.includes('logs') &&\n\t\t\t!collections.find(a => a.endsWith('.versions')) &&\n\t\t\t!collections.find(a => a.startsWith('monitor-'))\n\t\t) {\n\t\t\tlet nodeCacheSize = this._nodeCache.getStats().vsize;\n\n\t\t\tif (nodeCacheSize > this._heapLimit) {\n\t\t\t\tlet deleteCount = 0;\n\t\t\t\tconst keys = this._nodeCache.keys();\n\n\t\t\t\tfor (const key of keys) {\n\t\t\t\t\tthis._nodeCache.del(key);\n\t\t\t\t\tdeleteCount += 1;\n\n\t\t\t\t\tnodeCacheSize = this._nodeCache.getStats().vsize;\n\n\t\t\t\t\tif (nodeCacheSize < this._heapLimit * 0.75) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconsole.log('Query Cache: ' + 'Too Big, - Deleted: ' + deleteCount + ' - ' + nodeCacheSize);\n\t\t\t}\n\t\t\t\n\t\t\tthis._nodeCache.set(cacheKey, JSON.stringify(data));\n\t\t\tthis._cacheMap.push({ collections, key: cacheKey });\n\t\t}\n\t}\n\n\tpublic invalidateQueryCache(collection: string) {\n\t\tconst collectionCacheMap = this._cacheMap.filter(a => a.collections.includes(collection));\n\n\t\tif (ResolveIOServer.getMainServer().getSubscriptionManager() && ResolveIOServer.getMainServer().getSubscriptionManager().getEnableDebug()) {\n\t\t\tconsole.log(new Date(), 'Mongo Invalidate Cache', collection);\n\t\t}\n\n\t\tfor (const cacheMap of collectionCacheMap) {\n\t\t\tthis._nodeCache.del(cacheMap.key);\n\t\t\t\n\t\t\tif (this._operationInProgress.has(cacheMap.key)) {\n\t\t\t\tthis._operationInProgress.get(cacheMap.key).invalidatedDuringExecution = true;\n\n\t\t\t\tif (ResolveIOServer.getMainServer().getSubscriptionManager() && ResolveIOServer.getMainServer().getSubscriptionManager().getEnableDebug()) {\n\t\t\t\t\tconsole.log(new Date(), 'Mongo Invalidated During Execution', cacheMap.collections);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tfor (const [key, operation] of this._operationInProgress.entries()) {\n\t\t\tif (operation.collections.includes(collection)) {\n\t\t\t\toperation.invalidatedDuringExecution = true;\n\t\t\n\t\t\t\tif (ResolveIOServer.getMainServer().getSubscriptionManager() && ResolveIOServer.getMainServer().getSubscriptionManager().getEnableDebug()) {\n\t\t\t\t\tconsole.log(new Date(), 'Mongo Invalidated During Execution (No cache)', operation.collections);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tthis._cacheMap = this._cacheMap.filter(a => !a.collections.includes(collection));\n\t}\n\n\tprivate setupChangeStream() {\n\t\tconst db = ResolveIOServer.getMainDB();\n\n\t\tconst pipeline = [\n\t\t\t{\n\t\t\t\t$match: {\n\t\t\t\t\t$and: [\n\t\t\t\t\t\t{'ns.coll': { $nin: [\n\t\t\t\t\t\t\t'log-method-latencies', \n\t\t\t\t\t\t\t'log-subscriptions', \n\t\t\t\t\t\t\t'logs', \n\t\t\t\t\t\t\t'counters', \n\t\t\t\t\t\t\t'cron-job-histories', \n\t\t\t\t\t\t\t'email-histories',\n\t\t\t\t\t\t\t'qb-soap-request-histories', \n\t\t\t\t\t\t\t'qb-soap-request-responses', \n\t\t\t\t\t\t\t'qb-soap-requests',\n\t\t\t\t\t\t\t'qb-soap-retries'\n\t\t\t\t\t\t] }},\n\t\t\t\t\t\t{'ns.coll': { $not: /.*\\.versions$/ }},\n\t\t\t\t\t\t{'ns.coll': { $not: /^monitor-/ }},\n\t\t\t\t\t]\n\t\t\t\t},\n\t\t\t},\n\t\t];\n\t\tconst changeStream = db.watch(pipeline, { fullDocument: 'updateLookup' });\n\n\t\tchangeStream.on('change', (change: any) => {\n\t\t\tif (change['ns'] && change['ns'].coll) {\n\t\t\t\tconst collectionName = change['ns'].coll;\n\t\t\t\tconst collection = this.collection(collectionName);\n\n\t\t\t\tif (collection) {\n\t\t\t\t\tthis.invalidateQueryCache(collectionName);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tchangeStream.on('error', async () => {\n\t\t\tconsole.log(new Date(), 'Mongo change stream error. Restart...');\n\t\t\tawait changeStream.close();\n\t\t\tsetTimeout(() => this.setupChangeStream(), 5000);\n\t\t});\n\n\t\tchangeStream.on('close', () => {\n\t\t\tconsole.log(new Date(), 'Mongo change stream closed. Restarting...');\n\t\t\tsetTimeout(() => this.setupChangeStream(), 5000);\n\t\t});\n\t}\n}\n\nexport class MongoManagerModel<T extends CollectionDocument> {\n\tcollection_main: MongoManagerCollection<T> | MongoManagerUserCollection<T> = null;\n\tcollection_version: MongoManagerCollection<T> | MongoManagerUserCollection<T> = null;\n\n\tconstructor() {}\n\n\tstatic create<T>(options: MongoManagerCollectionOptions): MongoManagerModel<T> {\n\t\tconst mongoManagerModel = new MongoManagerModel<T>();\n\t\tmongoManagerModel.initialize(options);\n\t\treturn mongoManagerModel;\n\t}\n\n\tprivate initialize(options: MongoManagerCollectionOptions) {\n\t\tif (options.collectionName === 'users') {\n\t\t\tthis.collection_main = MongoManagerUserCollection.create(options) as MongoManagerUserCollection<T>;\n\t\t}\n\t\telse {\n\t\t\tthis.collection_main = MongoManagerCollection.create(options) as MongoManagerCollection<T>;\n\t\t}\n\n\t\tif (options.useVersionCollection) {\n\t\t\tthis.collection_main.useVersions = true;\n\t\t\t\n\t\t\tlet versionSchema = deepCopy(options.schema);\n\t\t\tversionSchema._id.type = 'Object';\n\t\t\tversionSchema._id.blackbox = true;\n\n\t\t\tlet versionOptions: MongoManagerCollectionOptions = {\n\t\t\t\tcollectionName: options.collectionName + '.versions',\n\t\t\t\tschema: versionSchema,\n\t\t\t\tuseVersionCollection: false,\n\t\t\t\tuseReportBuilder: false,\n\t\t\t\treportBuilderLookupTables: [],\n\t\t\t\ttimestamps: true,\n\t\t\t\tcreateLogs: false,\n\t\t\t\tcheckSchema: false,\n\t\t\t\tcollectionOptions: null,\n\t\t\t\tskipCache: true\n\t\t\t};\n\n\t\t\tif (options.collectionName === 'users') {\t\n\t\t\t\tthis.collection_version = MongoManagerUserCollection.create(versionOptions) as MongoManagerUserCollection<T>;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthis.collection_version = MongoManagerCollection.create(versionOptions) as MongoManagerCollection<T>;\n\t\t\t}\n\n\t\t\tsetImmediate(async () => {\n\t\t\t\tawait this.collection_version.createIndex({'_id._id': 1, '_id.__v': 1});\n\t\t\t});\n\n\t\t\tthis.collection_main.versionCollection = options.collectionName + '.versions';\n\t\t}\n\t}\n}\n\nexport interface MongoManagerCollectionOptions {\n\tcollectionName: string;\n\tschema: object;\n\tuseVersionCollection: boolean;\n\tuseReportBuilder: boolean;\n\treportBuilderLookupTables: LookupTables[]\n\ttimestamps: boolean;\n\tcreateLogs: boolean;\n\tcheckSchema: boolean;\n\tcollectionOptions: CreateCollectionOptions;\n\tskipCache?: boolean;\n\tbypassSession?: boolean;\n}\n\nexport class MongoManagerCollection<T extends CollectionDocument> {\n\tcollectionName = '';\n\tcheckSchema = false;\n\tsimplschema = null;\n\trbSchema = null;\n\ttimestamps = false;\n\tuseVersions = false;\n\tversionCollection = '';\n\tcreateLogs = true;\n\tuseRB = false;\n\tcollectionOptions: CreateCollectionOptions;\n\tskipCache = false;\n\tbypassSession = false;\n\t\n\tconstructor() {}\n\t\n\tstatic create(options: MongoManagerCollectionOptions) {\n\t\tconst mongoManagerCollection = new MongoManagerCollection();\n\t\tmongoManagerCollection.initialize(options);\n\t\treturn mongoManagerCollection;\n\t}\n\n\tinitialize(options: MongoManagerCollectionOptions) {\n\t\tthis.collectionName = options.collectionName;\n\t\tthis.simplschema = new SimpleSchema(options.schema);\n\t\tthis.timestamps = options.timestamps;\n\t\tthis.createLogs = options.createLogs;\n\t\tthis.checkSchema = options.checkSchema;\n\t\tthis.collectionOptions = options.collectionOptions;\n\t\tthis.skipCache = options.skipCache || false;\n\t\tthis.bypassSession = options.bypassSession || false;\n\n\t\tif (options.useReportBuilder) {\n\t\t\tthis.useRB = true;\n\t\t\tlet schemaCopy = deepCopy(options.schema);\n\t\t\tlet rbSchema = buildRbLookups(options.reportBuilderLookupTables, schemaCopy, []);\n\t\t\tthis.rbSchema = buildRbSchema(rbSchema);\n\t\t}\n\n\t\tlet interval = setInterval(async () => {\n\t\t\tif (ResolveIOServer && ResolveIOServer.getMainServer() && ResolveIOServer.getMongoManager() && ResolveIOServer.getMongoManager().getServerCollections().length) {\n\t\t\t\tawait ResolveIOServer.getMongoManager().registerCollection(this);\n\t\t\t\tclearInterval(interval);\n\t\t\t}\n\t\t}, 1);\n\t}\n\n\tprivate static indexQueue = async.queue(async (task, callback) => {\n\t\tconst { action, collection, specs, options } = task;\n\t\tconst dbCollection = ResolveIOServer.getMainDB().collection(collection.collectionName, collection.collectionOptions);\n\t\n\t\tif (!dbCollection) {\n\t\t\treturn callback(new Error(`Collection ${collection.collectionName} not found`));\n\t\t}\n\t\n\t\ttry {\n\t\t\t// Try creating the index, will auto-skip if already checked in createIndex/createIndexes\n\t\t\tconst result = await dbCollection[action](...specs, options);\n\t\t\tcallback(null, result);\n\t\t} catch (err) {\n\t\t\t// Handle any specific errors related to index creation\n\t\t\tif (err.code === 85 || err.message.includes('IndexOptionsConflict')) {\n\t\t\t\ttry {\n\t\t\t\t\tconst existingIndexName = collection.extractIndexNameFromError(err.message);\n\t\t\t\t\tif (existingIndexName) {\n\t\t\t\t\t\tawait dbCollection.dropIndex(existingIndexName);\n\t\t\t\t\t\tconst result = await dbCollection[action](...specs, options);\n\t\t\t\t\t\tcallback(null, result);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t} catch (innerError) {\n\t\t\t\t\tcallback(innerError);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcallback(err);\n\t\t}\n\t}, 1);\n\n\t// Method to extract index name from error message\n\textractIndexNameFromError(errorMessage) {\n\t\tlet regexPattern = /Index already exists with a different name: (\\S+)/;\n\t\tlet matches = errorMessage.match(regexPattern);\n\t\n\t\tif (!matches || matches.length <= 1) {\n\t\t\t// If the first pattern doesn't match, try the second pattern\n\t\t\tregexPattern = /existing index:.*name: \"([^\"]+)\"/;\n\t\t\tmatches = errorMessage.match(regexPattern);\n\t\t}\n\t\n\t\treturn matches && matches.length > 1 ? matches[1] : null;\n\t}\n\n\tasync aggregate(pipeline: object[], options?: AggregateOptions, skipCache = false, bypassSession = false) : Promise<any[]> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (!skipCache && !this.skipCache) {\n\t\t\treturn ResolveIOServer.getMongoManager().aggregate(this.collectionName, pipeline, options);\n\t\t}\n\t\telse {\n\t\t\t// eslint-disable-next-line no-unused-vars\n\t\t\tlet { session, ...safeOptions } = options || {};\n\t\t\tlet monitor = MonitorMongo.create('aggregate', this.collectionName, JSON.stringify([pipeline, safeOptions]));\n\n\t\t\ttry {\n\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).aggregate(pipeline, options).toArray();\n\t\t\t\treturn res;\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tconsole.log(new Date(), 'Error Aggregate', this.collectionName, JSON.stringify([pipeline, safeOptions, err], null, 2));\n\t\t\t\terr.message = `Error in Aggregate: ${this.collectionName} - ${err.message}`;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tawait monitor.finish();\n\t\t\t}\n\t\t}\n\t}\n\n\tasync aggregateCount(pipeline: object[], options?: AggregateOptions, bypassSession = false) : Promise<number> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\t\tlet monitor = MonitorMongo.create('aggregateCount', this.collectionName, JSON.stringify([pipeline, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).aggregate(pipeline, options).toArray();\n\t\t\treturn res.length;\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Aggregate Count', this.collectionName, JSON.stringify([pipeline, safeOptions, err], null, 2));\n\t\t\terr.message = `Error in Aggregate Count: ${this.collectionName} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\taggregateCursor(pipeline: object[], options?: AggregateOptions, bypassSession = false): AggregationCursor {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\t\tlet monitor = MonitorMongo.create('aggregateCursor', this.collectionName, JSON.stringify([pipeline, safeOptions]));\n\t\tlet cursor = ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).aggregate(pipeline, options);\n\t\tcursor.on('close', async ev => {\n\t\t\tawait monitor.finish();\n\t\t\treturn ev;\n\t\t});\n\n\t\treturn cursor;\n\t}\n\n\taggregateStream(pipeline: object[], options?: AggregateOptions, streamOptions?: CursorStreamOptions, bypassSession = false) {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\t\tlet monitor = MonitorMongo.create('aggregateStream', this.collectionName, JSON.stringify([pipeline, safeOptions, streamOptions]));\n\t\tlet stream = ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).aggregate(pipeline, options).stream(streamOptions).on('close', async ev => {\n\t\t\tawait monitor.finish();\n\t\t\treturn ev;\n\t\t});\n\n\t\treturn stream;\n\t}\n\n\tasync bulkWrite(\n\t\toperations: any[],\n\t\toptions?: BulkWriteOptions,\n\t\tbypassCheckSchema = false,\n\t\tbypassLogs = false,\n\t\tbypassVersions = false, \n\t\tbypassSession = false\n\t): Promise<BulkWriteResult> {\n\t\tif (!operations.length) {\n\t\t\treturn null;\n\t\t}\n\t\n\t\tconst BATCH_SIZE = 1000;\n\t\tlet opIndex = 0;\n\n\t\tlet sessionOptions = null;\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\t\n\t\twhile (opIndex < operations.length) {\n\t\t\tconst batchOps = operations.slice(opIndex, opIndex + BATCH_SIZE);\n\t\n\t\t\t// Initialize arrays for logs and version operations\n\t\t\tconst logs = [];\n\t\t\tconst versionOps = [];\n\t\n\t\t\tfor (const op of batchOps) {\n\t\t\t\tconst opType = Object.keys(op)[0];\n\t\t\t\tconst doc = op[opType];\n\t\n\t\t\t\t// Skip validation if bypassCheckSchema is true\n\t\t\t\tif (this.checkSchema && !bypassCheckSchema) {\n\t\t\t\t\tconst validationContext = this.simplschema.newContext();\n\t\t\t\t\tlet isValid: boolean;\n\t\n\t\t\t\t\tif (opType === 'insertOne') {\n\t\t\t\t\t\tisValid = validationContext.validate(doc.document);\n\t\t\t\t\t}\n\t\t\t\t\telse if (opType === 'replaceOne') {\n\t\t\t\t\t\tisValid = validationContext.validate(doc.replacement);\n\t\t\t\t\t}\n\t\t\t\t\telse if (opType === 'updateOne' || opType === 'updateMany') {\n\t\t\t\t\t\t// For updates, validate the update modifier\n\t\t\t\t\t\tisValid = validationContext.validate(doc.update, { modifier: true });\n\t\t\t\t\t}\n\t\t\t\t\telse if (opType === 'deleteOne' || opType === 'deleteMany') {\n\t\t\t\t\t\t// No validation needed for deletes\n\t\t\t\t\t\tisValid = true;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tthrow new Error(`Unsupported operation type: ${opType}`);\n\t\t\t\t\t}\n\t\n\t\t\t\t\tif (!isValid) {\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t`Schema validation failed for ${opType}: ${JSON.stringify(validationContext.validationErrors())}`\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\t// Now proceed to process the operations\n\t\n\t\t\t\tif (opType === 'insertOne') {\n\t\t\t\t\t// If this.timestamps is true, set createdAt and updatedAt\n\t\t\t\t\tif (this.timestamps) {\n\t\t\t\t\t\tif (!doc.document.createdAt) {\n\t\t\t\t\t\t\tdoc.document.createdAt = new Date();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (!doc.document.updatedAt) {\n\t\t\t\t\t\t\tdoc.document.updatedAt = new Date();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Prepare log entry\n\t\t\t\t\tif (!bypassLogs && this.createLogs) {\n\t\t\t\t\t\tlogs.push({\n\t\t\t\t\t\t\tinsertOne: {\n\t\t\t\t\t\t\t\tdocument: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: doc.document._id || objectIdHexString(),\n\t\t\t\t\t\t\t\t\tpayload:\n\t\t\t\t\t\t\t\t\t\tgetBinarySize(JSON.stringify(doc.document)) < 200000\n\t\t\t\t\t\t\t\t\t\t\t? JSON.stringify(doc.document, null, 2)\n\t\t\t\t\t\t\t\t\t\t\t: 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: 'insertOne',\n\t\t\t\t\t\t\t\t\tid_user: '', // Add user info if available\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date(),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Prepare version document\n\t\t\t\t\tif (!bypassVersions && this.useVersions) {\n\t\t\t\t\t\tconst versionDoc = {\n\t\t\t\t\t\t\t...doc.document,\n\t\t\t\t\t\t\t__v: 0,\n\t\t\t\t\t\t\t_id: { _id: doc.document._id || objectIdHexString(), __v: 0 },\n\t\t\t\t\t\t};\n\t\t\t\t\t\tversionOps.push({\n\t\t\t\t\t\t\tinsertOne: {\n\t\t\t\t\t\t\t\tdocument: versionDoc\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Since we might have modified doc.document, update the operation\n\t\t\t\t\top[opType].document = doc.document;\n\t\t\t\t}\n\t\t\t\telse if (opType === 'updateOne' || opType === 'updateMany') {\n\t\t\t\t\t// If this.timestamps is true, add updatedAt\n\t\t\t\t\tif (this.timestamps) {\n\t\t\t\t\t\tif (!doc.update.$set) {\n\t\t\t\t\t\t\tdoc.update.$set = {};\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdoc.update.$set.updatedAt = new Date();\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// If this.useVersions is true, increment __v\n\t\t\t\t\tif (!bypassVersions && this.useVersions) {\n\t\t\t\t\t\tif (!doc.update.$inc) {\n\t\t\t\t\t\t\tdoc.update.$inc = {};\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdoc.update.$inc.__v = 1;\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Prepare log entry\n\t\t\t\t\tif (!bypassLogs && this.createLogs) {\n\t\t\t\t\t\tlogs.push({\n\t\t\t\t\t\t\tinsertOne: {\n\t\t\t\t\t\t\t\tdocument: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: doc.filter._id || null,\n\t\t\t\t\t\t\t\t\tpayload:\n\t\t\t\t\t\t\t\t\t\tgetBinarySize(JSON.stringify(doc.update)) < 200000\n\t\t\t\t\t\t\t\t\t\t\t? JSON.stringify(doc.update, null, 2)\n\t\t\t\t\t\t\t\t\t\t\t: 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: opType,\n\t\t\t\t\t\t\t\t\tid_user: '', // Add user info if available\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date(),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// For versioning, store the filter to fetch the document later\n\t\t\t\t\tif (!bypassVersions && this.useVersions) {\n\t\t\t\t\t\tversionOps.push({\n\t\t\t\t\t\t\tfilter: doc.filter,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// No need to modify the operation further\n\t\t\t\t}\n\t\t\t\telse if (opType === 'replaceOne') {\n\t\t\t\t\t// If this.timestamps is true, set updatedAt\n\t\t\t\t\tif (this.timestamps) {\n\t\t\t\t\t\tdoc.replacement.updatedAt = new Date();\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// If this.useVersions is true, increment __v\n\t\t\t\t\tif (!bypassVersions && this.useVersions) {\n\t\t\t\t\t\tdoc.replacement.__v = (doc.replacement.__v || 0) + 1;\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Prepare log entry\n\t\t\t\t\tif (!bypassLogs && this.createLogs) {\n\t\t\t\t\t\tlogs.push({\n\t\t\t\t\t\t\tinsertOne: {\n\t\t\t\t\t\t\t\tdocument: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: doc.filter._id || null,\n\t\t\t\t\t\t\t\t\tpayload:\n\t\t\t\t\t\t\t\t\t\tgetBinarySize(JSON.stringify(doc.replacement)) < 200000\n\t\t\t\t\t\t\t\t\t\t\t? JSON.stringify(doc.replacement, null, 2)\n\t\t\t\t\t\t\t\t\t\t\t: 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\t\t\tid_user: '', // Add user info if available\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date(),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// For versioning, store the filter to fetch the document later\n\t\t\t\t\tif (!bypassVersions && this.useVersions) {\n\t\t\t\t\t\tversionOps.push({\n\t\t\t\t\t\t\tfilter: doc.filter,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Since we might have modified doc.replacement, update the operation\n\t\t\t\t\top[opType].replacement = doc.replacement;\n\t\t\t\t}\n\t\t\t\telse if (opType === 'deleteOne' || opType === 'deleteMany') {\n\t\t\t\t\t// Prepare log entry\n\t\t\t\t\tif (!bypassLogs && this.createLogs) {\n\t\t\t\t\t\tlogs.push({\n\t\t\t\t\t\t\tinsertOne: {\n\t\t\t\t\t\t\t\tdocument: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: doc.filter._id || null,\n\t\t\t\t\t\t\t\t\tpayload:\n\t\t\t\t\t\t\t\t\t\tgetBinarySize(JSON.stringify(doc.filter)) < 200000\n\t\t\t\t\t\t\t\t\t\t\t? JSON.stringify(doc.filter, null, 2)\n\t\t\t\t\t\t\t\t\t\t\t: 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: opType,\n\t\t\t\t\t\t\t\t\tid_user: '', // Add user info if available\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date(),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// For versioning, store the filter to fetch the document later\n\t\t\t\t\tif (!bypassVersions && this.useVersions) {\n\t\t\t\t\t\tversionOps.push({\n\t\t\t\t\t\t\tfilter: doc.filter,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// No need to modify the operation\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthrow new Error(`Unsupported operation type: ${opType}`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet affectedDocs = [];\n\t\n\t\t\t// Handle versioning\n\t\t\tif (!bypassVersions && this.useVersions && versionOps.length > 0) {\n\t\t\t\ttry {\n\t\t\t\t\t// Fetch the affected documents\n\t\t\t\t\tconst versionFilters = versionOps.map((v) => v.filter);\n\t\t\t\t\taffectedDocs = await ResolveIOServer.getMainDB().collection(this.collectionName).find({ $or: versionFilters }, sessionOptions).toArray();\n\t\t\n\t\t\t\t\t// Prepare version documents\n\t\t\t\t\tconst versionInserts = affectedDocs.map((doc) => ({\n\t\t\t\t\t\tinsertOne: {\n\t\t\t\t\t\t\tdocument: {\n\t\t\t\t\t\t\t\t...doc,\n\t\t\t\t\t\t\t\t_id: { _id: doc._id, __v: doc.__v },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t}));\n\t\t\n\t\t\t\t\t// Insert versions in bulk\n\t\t\t\t\tif (versionInserts.length > 0) {\n\t\t\t\t\t\tlet bwOptions = null;\n\t\t\t\t\t\tif (!sessionOptions) {\n\t\t\t\t\t\t\tbwOptions = {ordered: false};\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tbwOptions = {session: mongoSession, ordered: false};\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection(this.versionCollection).bulkWrite(<any>versionInserts, bwOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch(e) {\n\t\t\t\t\tconsole.error('Error during version creation:', e);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// eslint-disable-next-line no-unused-vars\n\t\t\tlet { session, ...safeOptions } = options || {};\n\n\t\t\t// Execute bulkWrite\n\t\t\tconst monitor = MonitorMongo.create('bulkWrite', this.collectionName, JSON.stringify([batchOps, safeOptions]));\n\n\t\t\ttry {\n\t\t\t\tawait ResolveIOServer.getMainDB().collection(this.collectionName).bulkWrite(batchOps, options);\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\terr.message = `Error in Bulk Write: ${this.collectionName} - ${err.message}`;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tawait monitor.finish();\n\t\t\t}\n\t\n\t\t\t// Insert logs in bulk\n\t\t\tif (!bypassLogs && this.createLogs && logs.length > 0) {\n\t\t\t\tif (\n\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t) {\n\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLogs(logs.map(a => {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\tdata: a\n\t\t\t\t\t\t};\n\t\t\t\t\t}));\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tlet bwOptions = null;\n\t\t\t\t\tif (!sessionOptions) {\n\t\t\t\t\t\tbwOptions = {ordered: false};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tbwOptions = {session: mongoSession, ordered: false};\n\t\t\t\t\t}\n\n\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').bulkWrite(logs, bwOptions);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!bypassVersions && this.useVersions) {\n\t\t\t\t// Delete old versions beyond the latest 5\n\t\t\t\ttry {\n\t\t\t\t\tconst affectedDocIds = affectedDocs.map((doc) => doc._id);\n\t\n\t\t\t\t\tconst pipeline = [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$match: { '_id._id': { $in: affectedDocIds } },\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$sort: { '_id._id': 1, '_id.__v': -1 },\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$group: {\n\t\t\t\t\t\t\t\t_id: '$_id._id',\n\t\t\t\t\t\t\t\tversions: { $push: '$_id' },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$project: {\n\t\t\t\t\t\t\t\tversionsToDelete: { $slice: ['$versions', 5, { $size: '$versions' }] },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{ $unwind: '$versionsToDelete' },\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$replaceRoot: { newRoot: { _id: '$versionsToDelete' } },\n\t\t\t\t\t\t},\n\t\t\t\t\t];\n\t\n\t\t\t\t\tconst oldVersions = await ResolveIOServer.getMainDB().collection(this.versionCollection).aggregate(pipeline, sessionOptions).toArray();\n\t\n\t\t\t\t\tif (oldVersions.length > 0) {\n\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection(this.versionCollection).deleteMany({ _id: { $in: oldVersions.map((v) => v._id) } }, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch (error) {\n\t\t\t\t\tconsole.error('Error during version cleanup:', error);\n\t\t\t\t\t// Handle the error as needed\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\topIndex += BATCH_SIZE;\n\t\n\t\t\t// Yield to the event loop\n\t\t\t// eslint-disable-next-line no-restricted-syntax\n\t\t\tawait new Promise((resolve) => setImmediate(resolve));\n\t\n\t\t\t// Invalidate cache\n\t\t\tif (!this.skipCache) {\n\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t}\n\t\t}\n\t\n\t\treturn { ok: 1 } as BulkWriteResult; // Adjust return value as per your requirements\n\t}\n\n\tasync countDocuments(\n\t\tfilter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {},\n\t\toptions?: CountDocumentsOptions,\n\t\tskipCache = false, \n\t\tbypassSession = false\n\t): Promise<number> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\t\t\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\t// Check if the filter is empty\n\t\tconst isUnfiltered = Object.keys(filter).length === 0;\n\n\t\tif (isUnfiltered) {\n\t\t\t// Use collection stats for an unfiltered count\n\t\t\treturn ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).estimatedDocumentCount(options);\n\t\t}\n\t\telse if (!skipCache && !this.skipCache) {\n\t\t\t// Use cached count if skipCache is false\n\t\t\treturn ResolveIOServer.getMongoManager().countDocuments(this.collectionName, filter, options);\n\t\t}\n\t\telse {\n\t\t\t// Fallback to direct countDocuments call with monitoring if skipCache is true\n\n\t\t\tlet monitor = MonitorMongo.create('countDocuments', this.collectionName, JSON.stringify([filter, safeOptions]));\n\n\t\t\ttry {\n\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).countDocuments(<any>filter, options);\n\t\t\t\treturn res;\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tconsole.log(new Date(), 'Error Count Documents', this.collectionName, filter, safeOptions, err);\n\t\t\t\terr.message = `Error in Count Documents: ${this.collectionName} - ${err.message}`;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tawait monitor.finish();\n\t\t\t}\n\t\t}\n\t}\n\n\t//Helper Function (1 or Many) - Not Real Mongo Function\n\tcreate(f_docs: T | T[], options?: InsertOneOptions | BulkWriteOptions): Promise<T | T[]> {\n\t\tif (!Array.isArray(f_docs)) {\n\t\t\treturn this.insertOne(f_docs, <InsertOneOptions>options);\n\t\t}\n\t\telse if (f_docs.length === 1) {\n\t\t\treturn this.insertOne(f_docs[0], <InsertOneOptions>options);\n\t\t}\n\n\t\treturn this.insertMany(f_docs, <BulkWriteOptions>options);\n\t}\n\n\tasync createIndex(fieldOrSpec: any, options?: CreateIndexesOptions): Promise<string> {\n\t\ttry {\n\t\t\t// Check if index already exists based on the key\n\t\t\tconst dbCollection = ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions);\n\t\t\tconst existingIndexes = await dbCollection.indexes();\n\n\t\t\t// Check if an index with the same key already exists\n\t\t\tconst indexExists = existingIndexes.some(index => \n\t\t\t\tJSON.stringify(index.key) === JSON.stringify(fieldOrSpec)\n\t\t\t);\n\n\t\t\tif (indexExists) {\n\t\t\t\treturn 'Index already exists'; // Skip creation if index exists\n\t\t\t}\n\n\t\t\t// If index doesn't exist, push it to the queue\n\t\t\tMongoManagerCollection.indexQueue.push({\n\t\t\t\taction: 'createIndex',\n\t\t\t\tcollection: this,\n\t\t\t\tspecs: [fieldOrSpec],\n\t\t\t\toptions: options\n\t\t\t}, (error, result) => {\n\t\t\t\tif (error) throw error;\n\t\t\t\telse return result;\n\t\t\t});\n\n\t\t\treturn 'Index creation queued';\n\t\t} \n\t\tcatch (err) {\n\t\t\tthrow err;\n\t\t}\n\t}\n\t\n\tasync createIndexes(indexSpecs: IndexDescription[], options?: CreateIndexesOptions): Promise<string[]> {\n\t\ttry {\n\t\t\tconst dbCollection = ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions);\n\t\t\tconst existingIndexes = await dbCollection.indexes();\n\n\t\t\t// Filter out indexes that already exist based on the key\n\t\t\tconst indexesToCreate = indexSpecs.filter(indexSpec => \n\t\t\t\t!existingIndexes.some(existingIndex => \n\t\t\t\t\tJSON.stringify(existingIndex.key) === JSON.stringify(indexSpec.key)\n\t\t\t\t)\n\t\t\t);\n\n\t\t\t// If no new indexes to create, resolve early\n\t\t\tif (indexesToCreate.length === 0) {\n\t\t\t\treturn ['All indexes already exist'];\n\t\t\t}\n\n\t\t\t// Push only new indexes to the queue\n\t\t\tMongoManagerCollection.indexQueue.push({\n\t\t\t\taction: 'createIndexes',\n\t\t\t\tcollection: this,\n\t\t\t\tspecs: [indexesToCreate],\n\t\t\t\toptions: options\n\t\t\t}, (error, result) => {\n\t\t\t\tif (error) throw error;\n\t\t\t\telse return result;\n\t\t\t});\n\n\t\t\treturn ['Index creation queued'];\n\t\t} \n\t\tcatch (err) {\n\t\t\tthrow err;\n\t\t}\n\t}\n\t\n\tasync deleteMany(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {}, options?: DeleteOptions, bypassLogs = false, bypassSession = false): Promise<number> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\t\t\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tif ((this.createLogs && !bypassLogs) || this.useVersions) {\n\t\t\tlet docs = await this.find(filter);\n\n\t\t\tfor (let i = 0; i < docs.length; i++) {\n\t\t\t\tlet doc = docs[i];\n\t\t\t\n\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t) {\n\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, safeOptions])) < 200000 ? JSON.stringify([doc, filter, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'deleteMany',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, safeOptions])) < 200000 ? JSON.stringify([doc, filter, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\tmethod: 'deleteMany',\n\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.useVersions) {\n\t\t\t\t\tlet versionDoc = deepCopy(doc);\n\t\t\t\t\tversionDoc._id = {_id: doc._id, __v: doc.__v};\n\n\t\t\t\t\tlet versionOptions = null;\n\t\t\t\t\tif (!sessionOptions) {\n\t\t\t\t\t\tversionOptions = {upsert: true};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tversionOptions = {session: mongoSession, upsert: true};\n\t\t\t\t\t}\n\n\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, versionOptions);\n\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).deleteMany(<any>{$and: [{'_id._id': doc._id}, {'_id.__v': {$lt: doc.__v - 1}}]}, sessionOptions);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tlet monitor = MonitorMongo.create('deleteMany', this.collectionName, JSON.stringify([filter, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).deleteMany(<any>filter, options);\n\t\t\tif (res.acknowledged) {\n\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t}\n\t\t\t\treturn res.deletedCount;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new Error(`Error in DeleteMany: ${this.collectionName}`);\n\t\t\t}\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Delete Many', this.collectionName, filter, safeOptions, err);\n\t\t\terr.message = `Error in Delete Many: ${this.collectionName} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync deleteOne(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {}, options?: FindOneAndDeleteOptions, bypassLogs = false, bypassSession = false): Promise<number> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tif (this.createLogs && !bypassLogs) {\n\t\t\tlet monitor = MonitorMongo.create('findOneAndDelete', this.collectionName, JSON.stringify([filter, safeOptions]));\n\t\t\t\n\t\t\ttry {\n\t\t\t\tlet returnVal = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).findOneAndDelete(<any>filter, options);\n\t\t\t\tlet doc = returnVal.value;\n\n\t\t\t\tif (doc) {\n\t\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: doc._id as string,\n\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, safeOptions])) < 200000 ? JSON.stringify([doc, filter, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: 'deleteOne',\n\t\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: doc._id as string,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, safeOptions])) < 200000 ? JSON.stringify([doc, filter, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'deleteOne',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (this.useVersions) {\n\t\t\t\t\t\tlet versionDoc = deepCopy(doc);\n\t\t\t\t\t\tversionDoc._id = {_id: doc._id, __v: doc.__v};\n\n\t\t\t\t\t\tlet versionOptions = null;\n\t\t\t\t\t\tif (!sessionOptions) {\n\t\t\t\t\t\t\tversionOptions = {upsert: true};\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tversionOptions = {session, upsert: true};\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, versionOptions);\n\t\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).deleteMany(<any>{$and: [{'_id._id': doc._id}, {'_id.__v': {$lt: doc.__v - 1}}]}, sessionOptions);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tconsole.log(new Date(), 'Error Delete One (Find One And Delete)', this.collectionName, filter, safeOptions, err);\n\t\t\t\terr.message = `Error in Delete One (Find One And Delete): ${this.collectionName} - ${err.message}`;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tawait monitor.finish();\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tlet monitor = MonitorMongo.create('deleteOne', this.collectionName, JSON.stringify([filter, safeOptions]));\n\n\t\t\ttry {\n\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).deleteOne(<any>filter, options);\n\t\t\t\tif (res.acknowledged) {\n\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t}\n\t\t\t\t\treturn res.deletedCount;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthrow new Error(`Error in Delete One: ${this.collectionName}`);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tconsole.log(new Date(), 'Error Delete One', this.collectionName, filter, safeOptions, err);\n\t\t\t\terr.message = `Error in Delete One: ${this.collectionName} - ${err.message}`;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tawait monitor.finish();\n\t\t\t}\n\t\t}\n\t}\n\n\tasync distinct(key: string, filter?: MongoManagerFilter<T> & MongoManagerFilterOperators<T>, options?: CommandOperationOptions, bypassSession = false): Promise<T[]> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('distinct', this.collectionName, JSON.stringify([key, filter, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).distinct(key, <any>filter, options);\n\t\t\treturn res;\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Distinct', this.collectionName, filter, safeOptions, err);\n\t\t\terr.message = `Error in Distinct: ${this.collectionName} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync drop(options?: CommandOperationOptions, bypassSession = false): Promise<boolean> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('drop', this.collectionName, JSON.stringify([safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).drop(options);\n\t\t\treturn res;\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Count Documents', this.collectionName, safeOptions, err);\n\t\t\terr.message = `Error in Count Documents: ${this.collectionName} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync dropIndex(indexName: string, options?: CommandOperationOptions, bypassSession = false): Promise<Document> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('dropIndex', this.collectionName, JSON.stringify([indexName, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).dropIndex(indexName, options);\n\t\t\treturn <Document>res;\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Drop Index', this.collectionName, indexName, safeOptions, err);\n\t\t\terr.message = `Error in Drop Index: ${this.collectionName} - ${indexName} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync dropIndexes(options?: CommandOperationOptions, bypassSession = false): Promise<Document> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('dropIndexes', this.collectionName, JSON.stringify([safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).dropIndexes(options);\n\t\t\treturn res;\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Drop Indexes', this.collectionName, safeOptions, err);\n\t\t\terr.message = `Error in Drop Indexes: ${this.collectionName} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync find(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {}, options?: FindOptions<T>, skipCache = false, bypassSession = false): Promise<T[]> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tif (!skipCache && !this.skipCache) {\n\t\t\treturn ResolveIOServer.getMongoManager().find(this.collectionName, filter, options);\n\t\t}\n\t\telse {\n\t\t\tlet monitor = MonitorMongo.create('find', this.collectionName, JSON.stringify([filter, safeOptions]));\n\n\t\t\ttry {\n\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).find<T>(<any>filter, options).toArray();\n\t\t\t\treturn res;\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tconsole.log(new Date(), 'Error Find', this.collectionName, filter, safeOptions, err);\n\t\t\t\terr.message = `Error in Find: ${this.collectionName} - ${JSON.stringify(filter, null, 2)} - ${err.message}`;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tawait monitor.finish();\n\t\t\t}\n\t\t}\n\t}\n\n\tasync findById(id: string, options?: FindOptions<T>, skipCache = false, bypassSession = false): Promise<T> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tif (!skipCache && !this.skipCache) {\n\t\t\treturn ResolveIOServer.getMongoManager().findOne(this.collectionName, {_id: id}, options);\n\t\t}\n\t\telse {\n\t\t\tlet monitor = MonitorMongo.create('findById', this.collectionName, JSON.stringify([{_id: id}, safeOptions]));\n\t\t\t\n\t\t\ttry {\n\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).findOne<T>(<any>{_id: id}, options);\n\t\t\t\treturn res;\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tconsole.log(new Date(), 'Error Find By Id', this.collectionName, {_id: id}, safeOptions, err);\n\t\t\t\terr.message = `Error in Find By ID: ${this.collectionName} - ${id} - ${err.message}`;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tawait monitor.finish();\n\t\t\t}\n\t\t}\n\t}\n\n\tasync findCount(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {}, options?: FindOptions<T>, bypassSession = false): Promise<Number> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('findCount', this.collectionName, JSON.stringify([filter, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).find(<any>filter, options).count();\n\t\t\treturn res;\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Find Count', this.collectionName, filter, safeOptions, err);\n\t\t\terr.message = `Error in Find Count: ${this.collectionName} - ${JSON.stringify(filter, null, 2)} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tfindCursor(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {}, options?: FindOptions<T>, bypassSession = false): FindCursor {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\t\t\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('findCursor', this.collectionName, JSON.stringify([filter, safeOptions]));\n\t\tlet cursor = ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).find(<any>filter, options);\n\t\tcursor.on('close', async ev => {\n\t\t\tawait monitor.finish();\n\t\t\tcursor.removeAllListeners();\n\t\t\treturn ev;\n\t\t});\n\n\t\treturn cursor;\n\t}\n\n\tfindStream(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {}, options?: FindOptions<T>, streamOptions?: CursorStreamOptions, bypassSession = false) {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\t\t\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\t\t\n\t\tlet monitor = MonitorMongo.create('findStream', this.collectionName, JSON.stringify([filter, safeOptions, streamOptions]));\n\t\tlet stream = ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).find(<any>filter, options).stream(streamOptions).on('close', async ev => {\n\t\t\tawait monitor.finish();\n\t\t\treturn ev;\n\t\t});\n\n\t\treturn stream;\n\t}\n\n\tasync findOne(filter: MongoManagerFilter<T> | MongoManagerFilterOperators<T> = {}, options?: FindOptions<T>, skipCache = false, bypassSession = false): Promise<T> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\tif (!skipCache && !this.skipCache) {\n\t\t\treturn ResolveIOServer.getMongoManager().findOne(this.collectionName, filter, options);\n\t\t}\n\t\telse {\n\t\t\t// eslint-disable-next-line no-unused-vars\n\t\t\tlet { session, ...safeOptions } = options || {};\n\n\t\t\tlet monitor = MonitorMongo.create('findOne', this.collectionName, JSON.stringify([filter, safeOptions]));\n\t\t\t\n\t\t\ttry {\n\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).findOne<T>(<any>filter, options);\n\t\t\t\treturn res;\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tconsole.log(new Date(), 'Error Find One', this.collectionName, filter, safeOptions, err);\n\t\t\t\terr.message = `Error in Find One: ${this.collectionName} - ${JSON.stringify(filter, null, 2)} - ${err.message}`;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tawait monitor.finish();\n\t\t\t}\n\t\t}\n\t}\n\n\tasync findOneAndDelete(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {}, options?: FindOneAndDeleteOptions, bypassLogs = false, bypassSession = false): Promise<T> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('findOneAndDelete', this.collectionName, JSON.stringify([filter, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).findOneAndDelete(<any>filter, options);\n\t\t\tlet doc = res.value;\n\t\t\t\n\t\t\tif (doc) {\n\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t) {\n\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: doc._id as string,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, safeOptions])) < 200000 ? JSON.stringify([doc, filter, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'findOneAndDelete',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\tid_document: doc._id as string,\n\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, safeOptions])) < 200000 ? JSON.stringify([doc, filter, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\tmethod: 'findOneAndDelete',\n\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.useVersions) {\n\t\t\t\t\tlet versionDoc = deepCopy(doc);\n\t\t\t\t\tversionDoc._id = {_id: doc._id, __v: doc.__v};\n\n\t\t\t\t\tlet versionOptions = null;\n\t\t\t\t\tif (!sessionOptions) {\n\t\t\t\t\t\tversionOptions = {upsert: true};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tversionOptions = {session, upsert: true};\n\t\t\t\t\t}\n\n\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, versionOptions);\n\t\t\t\t}\n\n\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t}\n\n\t\t\t\treturn <T>doc;\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Find One And Delete', this.collectionName, filter, safeOptions, err);\n\t\t\terr.message = `Error in Find One And Delete: ${this.collectionName} - ${JSON.stringify(filter, null, 2)} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync findOneAndReplace(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {}, replacement: T, options?: FindOneAndReplaceOptions, bypassLogs = false, bypassCheckSchema = false, bypassSession = false): Promise<T> {\n\t\tif (this.checkSchema && !bypassCheckSchema) {\n\t\t\tconst validation = this.simplschema.newContext();\n\t\t\tconst isValid = validation.validate(replacement);\n\n\t\t\tif (!isValid) {\n\t\t\t\tconsole.log(new Date(), this.collectionName, 'Schema Errors - findOneAndReplace', validation.validationErrors());\n\t\t\t\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on findOneAndReplace - ' + this.collectionName, [validation.validationErrors(), replacement]);\n\t\t\t\t\n\t\t\t\tthrow validation.validationErrors();\n\t\t\t}\n\t\t}\n\t\t\n\t\tlet date = new Date();\n\n\t\tif (this.timestamps) {\n\t\t\treplacement.updatedAt = date;\n\t\t}\n\n\t\tif (options && options.upsert) {\n\t\t\tif (!replacement._id) {\n\t\t\t\treplacement._id = objectIdHexString();\n\t\t\t}\n\n\t\t\tif (this.useVersions) {\n\t\t\t\treplacement.__v = 0;\n\t\t\t}\n\n\t\t\tif (this.timestamps && !replacement.createdAt) {\n\t\t\t\treplacement.createdAt = date;\n\t\t\t}\n\t\t}\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('findOneAndReplace', this.collectionName, JSON.stringify([filter, replacement, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).findOneAndReplace(<any>filter, replacement, options);\n\t\t\tlet doc = res.value;\n\n\t\t\tif (doc) {\n\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t) {\n\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: doc._id as string,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, replacement, safeOptions])) < 200000 ? JSON.stringify([doc, filter, replacement, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'findOneAndReplace',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\tid_document: doc._id as string,\n\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, replacement, safeOptions])) < 200000 ? JSON.stringify([doc, filter, replacement, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\tmethod: 'findOneAndReplace',\n\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.useVersions) {\n\t\t\t\t\tlet versionDoc = deepCopy(doc);\n\t\t\t\t\tversionDoc._id = {_id: doc._id, __v: doc.__v};\n\n\t\t\t\t\tlet versionOptions = null;\n\t\t\t\t\tif (!sessionOptions) {\n\t\t\t\t\t\tversionOptions = {upsert: true};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tversionOptions = {session, upsert: true};\n\t\t\t\t\t}\n\n\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, versionOptions);\n\t\t\t\t}\n\n\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t}\n\n\t\t\t\treturn <T>doc;\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Find One And Replace', this.collectionName, filter, safeOptions, err);\n\t\t\terr.message = `Error in Find One And Replace: ${this.collectionName} - ${JSON.stringify(filter, null, 2)} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync findOneAndUpdate(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {}, update: MongoManagerUpdateFilter<T>, options?: FindOneAndUpdateOptions, bypassLogs = false, bypassCheckSchema = false, bypassSession = false): Promise<T> {\n\t\tif (this.checkSchema && !bypassCheckSchema) {\n\t\t\tconst validation = this.simplschema.newContext();\n\t\t\tconst isValid = validation.validate(update, {modifier: true});\n\n\t\t\tif (!isValid) {\n\t\t\t\tconsole.log(new Date(), this.collectionName, 'Schema Errors - findOneAndUpdate', validation.validationErrors());\n\t\t\t\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on findOneAndUpdate - ' + this.collectionName, [validation.validationErrors(), update]);\n\t\t\t\tthrow validation.validationErrors();\n\t\t\t}\n\t\t}\n\n\t\tif (this.timestamps) {\n\t\t\tlet date = new Date(); \n\t\t\t\n\t\t\tif (!update.$set) {\n\t\t\t\tupdate.$set = <any>{updatedAt: date};\n\t\t\t}\n\t\t\telse {\n\t\t\t\tupdate.$set.updatedAt = date;\n\t\t\t}\n\t\t}\n\n\t\tif (options && options.upsert) {\n\t\t\tif (!update.$setOnInsert) {\n\t\t\t\tif (this.timestamps) {\n\t\t\t\t\tupdate.$setOnInsert = <any>{\n\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tupdate.$setOnInsert = <any>{\n\t\t\t\t\t\t_id: objectIdHexString()\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (!update.$setOnInsert._id) {\n\t\t\t\t\tupdate.$setOnInsert._id = objectIdHexString();\n\t\t\t\t}\n\n\t\t\t\tif (this.timestamps && !update.$setOnInsert.createdAt) {\n\t\t\t\t\tupdate.$setOnInsert.createdAt = new Date();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('findOneAndUpdate', this.collectionName, JSON.stringify([filter, update, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).findOneAndUpdate(<any>filter, <any>update, options);\n\t\t\tlet doc = res.value;\n\n\t\t\tif (doc) {\n\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t) {\t\n\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: <string>doc._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, update, safeOptions])) < 200000 ? JSON.stringify([doc, filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'findOneAndUpdate',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\tid_document: <string>doc._id,\n\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, update, safeOptions])) < 200000 ? JSON.stringify([doc, filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\tmethod: 'findOneAndUpdate',\n\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.useVersions) {\n\t\t\t\t\tlet versionDoc = deepCopy(doc);\n\t\t\t\t\tversionDoc._id = {_id: doc._id, __v: doc.__v};\n\n\t\t\t\t\tlet versionOptions = null;\n\t\t\t\t\tif (!sessionOptions) {\n\t\t\t\t\t\tversionOptions = {upsert: true};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tversionOptions = {session, upsert: true};\n\t\t\t\t\t}\n\n\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, versionOptions);\n\t\t\t\t}\n\n\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\treturn <T>doc;\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Find One And Update', this.collectionName, filter, safeOptions, err);\n\t\t\terr.message = `Error in Find One And Update: ${this.collectionName} - ${JSON.stringify(filter, null, 2)} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync indexes(options: IndexInformationOptions, bypassSession = false): Promise<any[]> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('indexes', this.collectionName, JSON.stringify([safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).indexes(options);\n\t\t\treturn res;\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Indexes', this.collectionName, safeOptions, err);\n\t\t\terr.message = `Error in Indexes: ${this.collectionName} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync indexExists(indexes: string | string[], options?: IndexInformationOptions, bypassSession = false): Promise<boolean> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('indexExists', this.collectionName, JSON.stringify([indexes, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).indexExists(indexes, options);\n\t\t\treturn res;\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Index Exists', this.collectionName, indexes, safeOptions, err);\n\t\t\terr.message = `Error in Index Exists: ${this.collectionName} - ${JSON.stringify(indexes, null, 2)} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync insertMany(docs: T[], options?: BulkWriteOptions, bypassLogs = false, bypassCheckSchema = false, bypassMonitor = false, bypassSession = false): Promise<T[]> {\n\t\tif (!docs.length) {\n\t\t\treturn [];\n\t\t}\n\t\t\n\t\tlet validationResults = [];\n\n\t\tif (this.checkSchema && !bypassCheckSchema) {\n\t\t\tdocs.forEach(doc => {\n\t\t\t\tconst validation = this.simplschema.newContext();\n\t\t\t\tconst isValid = validation.validate(doc);\n\n\t\t\t\tif (!isValid) {\n\t\t\t\t\tconsole.log(new Date(), this.collectionName, 'Schema Errors - insertMany', validation.validationErrors());\n\t\t\t\t\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on insertMany - ' + this.collectionName, [validation.validationErrors(), doc]);\n\t\t\t\t\tvalidationResults.push(false);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tvalidationResults.push(true);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tlet validDocs = this.checkSchema ? docs.filter((a, idx) => validationResults[idx]) : docs;\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tfor (let i = 0; i < validDocs.length; i++) {\n\t\t\tlet doc = validDocs[i];\n\n\t\t\tif (!doc._id) {\n\t\t\t\tdoc._id = objectIdHexString();\n\t\t\t}\n\n\t\t\tif (this.timestamps) {\n\t\t\t\tlet date = new Date();\n\n\t\t\t\tif (!doc.createdAt) {\n\t\t\t\t\tdoc.createdAt = date;\n\t\t\t\t}\n\n\t\t\t\tif (!doc.updatedAt) {\n\t\t\t\t\tdoc.updatedAt = date;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.useVersions && !doc.hasOwnProperty('__v')) {\n\t\t\t\tdoc.__v = 0;\n\t\t\t}\n\n\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\tif (\n\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t) {\n\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, safeOptions])) < 200000 ? JSON.stringify([doc, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\tmethod: 'insertMany',\n\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, safeOptions])) < 200000 ? JSON.stringify([doc, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\tmethod: 'insertMany',\n\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\troute: '',\n\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t}, sessionOptions);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (validDocs.length) {\n\t\t\tlet monitor = null;\n\t\t\t\n\t\t\tif (!bypassMonitor) {\n\t\t\t\tmonitor = MonitorMongo.create('insertMany', this.collectionName, JSON.stringify([validDocs, safeOptions]));\n\t\t\t}\n\t\t\t\n\t\t\ttry {\n\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).insertMany(<OptionalUnlessRequiredId<T>[]>validDocs, options);\n\n\t\t\t\tif (res.acknowledged) {\n\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t}\n\t\t\t\t\treturn validDocs;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthrow new Error(`Error in Insert Many: ${this.collectionName} - ${JSON.stringify(res, null, 2)}`);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tconsole.log(new Date(), 'Error Insert Many', this.collectionName, validDocs, safeOptions, err);\n\t\t\t\terr.message = `Error in Insert Many: ${this.collectionName} - ${err.message}`;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tif (monitor) {\n\t\t\t\t\tmonitor.finish();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn [];\n\t}\n\n\tasync insertOne(doc: T, options?: InsertOneOptions, bypassLogs = false, bypassCheckSchema = false, bypassSession = false): Promise<T> {\n\t\tif (!doc._id) {\n\t\t\tdoc._id = objectIdHexString();\n\t\t}\n\n\t\tif (this.checkSchema && !bypassCheckSchema) {\n\t\t\tconst validation = this.simplschema.newContext();\n\t\t\tconst isValid = validation.validate(doc);\n\n\t\t\tif (!isValid) {\n\t\t\t\tconsole.log(new Date(), this.collectionName, 'Schema Errors - insertOne', validation.validationErrors());\n\t\t\t\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on insertOne - ' + this.collectionName, [validation.validationErrors(), doc]);\n\t\t\t\tthrow validation.validationErrors();\n\t\t\t}\n\t\t}\n\n\t\tif (this.timestamps) {\n\t\t\tlet date = new Date();\n\t\t\n\t\t\tif (!doc.createdAt) {\n\t\t\t\tdoc.createdAt = date;\n\t\t\t}\n\n\t\t\tif (!doc.updatedAt) {\n\t\t\t\tdoc.updatedAt = date;\n\t\t\t}\n\t\t}\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tif (this.createLogs && !bypassLogs) {\n\t\t\tif (\n\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t) {\n\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\ttype: 'log',\n\t\t\t\t\tdata: {\n\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, safeOptions])) < 200000 ? JSON.stringify([doc, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\tmethod: 'insertOne',\n\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\troute: '',\n\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\telse {\n\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\ttype: 'document',\n\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, safeOptions])) < 200000 ? JSON.stringify([doc, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\tmethod: 'insertOne',\n\t\t\t\t\tid_user: '',\n\t\t\t\t\tuser: '',\n\t\t\t\t\tmessageId: 0,\n\t\t\t\t\troute: '',\n\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t}, sessionOptions);\n\t\t\t}\n\t\t}\n\n\t\tif (this.useVersions && !doc.hasOwnProperty('__v')) {\n\t\t\tdoc.__v = 0;\n\t\t}\n\n\t\tlet monitor = MonitorMongo.create('insertOne', this.collectionName, JSON.stringify([doc, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).insertOne(<OptionalUnlessRequiredId<T>>doc, options);\n\t\t\tif (res.acknowledged) {\n\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\treturn doc;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new Error(`Error in Insert One: ${this.collectionName} - ${JSON.stringify(res, null, 2)}`);\n\t\t\t}\n\t\t}\n\t\tcatch(err) {\n\t\t\tconsole.log(new Date(), 'Error Insert One', this.collectionName, doc, safeOptions, err);\n\t\t\terr.message = `Error in Insert One: ${this.collectionName} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tlistIndexes(options?: ListIndexesOptions, bypassSession = false): ListIndexesCursor {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\t\t\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('listIndexes', this.collectionName, JSON.stringify([safeOptions]));\n\t\tlet cursor = ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).listIndexes(options);\n\t\tcursor.on('close', async ev => {\n\t\t\tawait monitor.finish();\n\t\t\treturn ev;\n\t\t});\n\n\t\treturn cursor;\n\t}\n\n\tasync rename(newName: string, options?: RenameOptions, bypassSession = false): Promise<Collection<Document>> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('rename', this.collectionName, JSON.stringify([newName, safeOptions]));\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).rename(newName, options);\n\t\t\treturn res;\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Rename', this.collectionName, newName, safeOptions, err);\n\t\t\terr.message = `Error in Rename: ${this.collectionName} - ${newName} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync replaceOne(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T>, replacement: T, options?: ReplaceOptions, bypassLogs = false, bypassCheckSchema = false, doc: T = null, bypassSession = false) : Promise<number> {\n\t\tif (this.checkSchema && !bypassCheckSchema) {\n\t\t\tconst validation = this.simplschema.newContext();\n\t\t\tconst isValid = validation.validate(replacement);\n\n\t\t\tif (!isValid) {\n\t\t\t\tconsole.log(new Date(), this.collectionName, 'Schema Errors - replaceOne', validation.validationErrors());\n\t\t\t\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on replaceOne - ' + this.collectionName, [validation.validationErrors(), replacement]);\n\t\t\t\tthrow validation.validationErrors();\n\t\t\t}\n\t\t}\n\t\t\n\t\tlet date = new Date();\n\t\t\n\t\tif (this.timestamps) {\n\t\t\treplacement.updatedAt = date;\n\t\t}\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tif (this.useVersions) {\n\t\t\tif (!doc) {\n\t\t\t\tdoc = await this.findOne(<any>filter, null, true);\n\t\t\t}\n\n\t\t\tif (doc) {\n\t\t\t\tif (this.timestamps && !replacement.createdAt && doc.createdAt) {\n\t\t\t\t\treplacement.createdAt = doc.createdAt;\n\t\t\t\t}\n\n\t\t\t\tif (doc.__v === replacement.__v) {\n\t\t\t\t\treplacement.__v += 1;\n\n\t\t\t\t\tlet versionDoc = deepCopy(doc);\n\t\t\t\t\tversionDoc._id = {_id: doc._id, __v: doc.__v};\n\n\t\t\t\t\tlet versionOptions = null;\n\t\t\t\t\tif (!sessionOptions) {\n\t\t\t\t\t\tversionOptions = {upsert: true};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tversionOptions = {session, upsert: true};\n\t\t\t\t\t}\n\n\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, versionOptions);\n\n\t\t\t\t\tif (doc.__v >= 4) {\n\t\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).deleteMany(<any>{$and: [{'_id._id': doc._id}, {'_id.__v': {$lt: doc.__v - 4}}]}, sessionOptions);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, replacement, safeOptions])) < 200000 ? JSON.stringify([doc, filter, replacement, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, replacement, safeOptions])) < 200000 ? JSON.stringify([doc, filter, replacement, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tlet monitor = MonitorMongo.create('replaceOne', this.collectionName, JSON.stringify([filter, replacement, safeOptions]));\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).replaceOne(<any>filter, replacement, options);\n\t\t\t\t\t\tif (res.acknowledged) {\n\t\t\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn res.modifiedCount;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tthrow new Error(`Error in Replace One: ${this.collectionName} - ${JSON.stringify(res, null, 2)}`);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcatch (err) {\n\t\t\t\t\t\tconsole.log(new Date(), 'Error Replace One', this.collectionName, filter, replacement, safeOptions, err);\n\t\t\t\t\t\terr.message = `Error in Replace One: ${this.collectionName} - ${err.message}`;\n\t\t\t\t\t\tthrow err;\n\t\t\t\t\t}\n\t\t\t\t\tfinally {\n\t\t\t\t\t\tawait monitor.finish();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tconsole.log('invalid version - ' + this.collectionName, doc.__v, replacement.__v);\n\n\t\t\t\t\tlet prevDoc = await ResolveIOServer.getMongoManager().collection(this.versionCollection).findOne({\n\t\t\t\t\t\t_id: <any>{\n\t\t\t\t\t\t\t_id: doc._id,\n\t\t\t\t\t\t\t__v: replacement.__v\n\t\t\t\t\t\t}\n\t\t\t\t\t}, null, true);\n\n\t\t\t\t\tif (prevDoc) {\n\t\t\t\t\t\tlet docId = doc._id;\n\t\t\t\t\t\tlet docVersion = doc.__v;\n\t\t\t\t\t\tlet updatedDoc: T = getMongoMergeUpdatedDoc(replacement, doc, prevDoc);\n\t\t\t\t\t\tupdatedDoc._id = docId;\n\t\t\t\t\t\tupdatedDoc.__v = docVersion + 1;\n\n\t\t\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\t\tid_document: docId,\n\t\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['invalidVersion - merge', doc, filter, updatedDoc, safeOptions])) < 200000 ? JSON.stringify(['invalidVersion - merge', doc, filter, updatedDoc, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: docId,\n\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['invalidVersion - merge', doc, filter, updatedDoc, safeOptions])) < 200000 ? JSON.stringify(['invalidVersion - merge', doc, filter, updatedDoc, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlet monitor = MonitorMongo.create('replaceOne', this.collectionName, JSON.stringify([filter, updatedDoc, safeOptions]));\n\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).replaceOne(<any>filter, updatedDoc, options);\n\t\t\t\t\t\t\tif (res.acknowledged) {\n\t\t\t\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn res.modifiedCount;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tthrow new Error(`Error in Replace One: ${this.collectionName} - ${JSON.stringify(res, null, 2)}`);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch (err) {\n\t\t\t\t\t\t\tconsole.log(new Date(), 'Error Replace One', this.collectionName, filter, updatedDoc, safeOptions, err);\n\t\t\t\t\t\t\terr.message = `Error in Replace One: ${this.collectionName} - ${err.message}`;\n\t\t\t\t\t\t\tthrow err;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfinally {\n\t\t\t\t\t\t\tawait monitor.finish();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tthrow new Error('Error in Replcae One: Invalid Version And Could Not Find History - DB: ' + doc.__v + ', Trying to update with :' + replacement.__v);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (options && options.upsert) {\n\t\t\t\tif (this.timestamps) {\n\t\t\t\t\treplacement.createdAt = date;\n\t\t\t\t}\n\n\t\t\t\tif (!replacement._id) {\n\t\t\t\t\treplacement._id = objectIdHexString();\n\t\t\t\t}\n\n\t\t\t\treplacement.__v = 0;\n\n\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t) {\n\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: replacement._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['upsert', filter, replacement, safeOptions])) < 200000 ? JSON.stringify(['upsert', filter, replacement, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\tid_document: replacement._id,\n\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['upsert', filter, replacement, safeOptions])) < 200000 ? JSON.stringify(['upsert', filter, replacement, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tlet monitor = MonitorMongo.create('replaceOne', this.collectionName, JSON.stringify([filter, replacement, safeOptions]));\n\n\t\t\t\ttry {\n\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).replaceOne(<any>filter, replacement, options);\n\t\t\t\t\tif (res.acknowledged) {\n\t\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn res.modifiedCount;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tthrow new Error(`Error in Replace One: ${this.collectionName} - ${JSON.stringify(res, null, 2)}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(new Date(), 'Error Replace One', this.collectionName, filter, replacement, safeOptions, err);\n\t\t\t\t\terr.message = `Error in Replace One: ${this.collectionName} - ${err.message}`;\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t\tfinally {\n\t\t\t\t\tawait monitor.finish();\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new Error('Error in Replace One: No Document');\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tif (options && options.upsert) {\n\t\t\t\tif (this.timestamps && !replacement.createdAt) {\n\t\t\t\t\treplacement.createdAt = date;\n\t\t\t\t}\n\n\t\t\t\tif (!replacement._id) {\n\t\t\t\t\treplacement._id = objectIdHexString();\n\t\t\t\t}\n\n\t\t\t\treplacement.__v = 0;\n\t\t\t}\n\n\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\tif (!options) {\n\t\t\t\t\toptions = <FindOneAndReplaceOptions>{returnDocument: 'before'};\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t(<FindOneAndReplaceOptions>options).returnDocument = 'before';\n\t\t\t\t}\n\n\t\t\t\t// eslint-disable-next-line no-unused-vars\n\t\t\t\tlet { session, ...safeOptions } = options || {};\n\n\t\t\t\tlet monitor = MonitorMongo.create('findOneAndReplace', this.collectionName, JSON.stringify([filter, replacement, safeOptions]));\n\n\t\t\t\ttry {\n\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).findOneAndReplace(<any>filter, replacement, <FindOneAndReplaceOptions>options);\n\t\t\t\t\tlet doc = res.value;\n\n\t\t\t\t\tif (doc) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: <string>doc._id,\n\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, replacement, safeOptions])) < 200000 ? JSON.stringify([doc, filter, replacement, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: <string>doc._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, replacement, safeOptions])) < 200000 ? JSON.stringify([doc, filter, replacement, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: replacement._id,\n\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['upsert', filter, replacement, safeOptions])) < 200000 ? JSON.stringify(['upsert', filter, replacement, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: replacement._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['upsert', filter, replacement, safeOptions])) < 200000 ? JSON.stringify(['upsert', filter, replacement, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(new Date(), 'Error Replace One (Find One And Replace)', this.collectionName, filter, replacement, safeOptions, err);\n\t\t\t\t\terr.message = `Error in Replace One (Find One And Replace): ${this.collectionName} - ${err.message}`;\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t\tfinally {\n\t\t\t\t\tawait monitor.finish();\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tlet monitor = MonitorMongo.create('replaceOne', this.collectionName, JSON.stringify([filter, replacement, safeOptions]));\n\n\t\t\t\ttry {\n\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).replaceOne(<any>filter, replacement, options);\n\t\t\t\t\tif (res.acknowledged) {\n\t\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn res.modifiedCount;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\treturn res.acknowledged;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(new Date(), 'Error Replace One', this.collectionName, filter, replacement, safeOptions, err);\n\t\t\t\t\terr.message = `Error in Aggregate: ${this.collectionName} - ${err.message}`;\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t\tfinally {\n\t\t\t\t\tawait monitor.finish();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tasync updateMany(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T>, update: MongoManagerUpdateFilter<T>, options?: UpdateOptions, bypassLogs = false, bypassCheckSchema = false, bypassVersions = false, bypassSession = false) : Promise<number> {\n\t\tif ((!update.$inc || JSON.stringify(update.$inc) === '{}') && (!update.$set || JSON.stringify(update.$set) === '{}') && (!update.$setOnInsert || JSON.stringify(update.$setOnInsert) === '{}') && (!update.$unset || JSON.stringify(update.$unset) === '{}')) {\n\t\t\treturn 1;\n\t\t}\n\t\t\n\t\tif (this.timestamps) {\n\t\t\tlet date = new Date();\n\n\t\t\tif (!update.$set) {\n\t\t\t\tupdate.$set = <any>{updatedAt: date};\n\t\t\t}\n\t\t\telse {\n\t\t\t\tupdate.$set.updatedAt = date;\n\t\t\t}\n\t\t}\n\n\t\tif (this.checkSchema && !bypassCheckSchema) {\n\t\t\tconst validation = this.simplschema.newContext();\n\t\t\tconst isValid = validation.validate(update, {modifier: true});\n\n\t\t\tif (!isValid) {\n\t\t\t\tconsole.log(new Date(), this.collectionName, 'Schema Errors - updateMany', validation.validationErrors());\n\t\t\t\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on updateMany - ' + this.collectionName, [validation.validationErrors(), update]);\n\t\t\t\tthrow validation.validationErrors();\n\t\t\t}\n\t\t}\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tif ((this.useVersions && !bypassVersions) || (this.createLogs && !bypassLogs)) {\n\t\t\tlet docs = await this.find(filter);\n\n\t\t\tfor (let i = 0; i < docs.length; i++) {\n\t\t\t\tlet doc = docs[i];\n\n\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t) {\n\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, update, safeOptions])) < 200000 ? JSON.stringify([doc, filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'updateMany',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, update, safeOptions])) < 200000 ? JSON.stringify([doc, filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\tmethod: 'updateMany',\n\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.useVersions) {\n\t\t\t\t\tlet versionDoc = deepCopy(doc);\n\t\t\t\t\tversionDoc._id = {_id: doc._id, __v: doc.__v};\n\n\t\t\t\t\tlet versionOptions = null;\n\t\t\t\t\tif (!sessionOptions) {\n\t\t\t\t\t\tversionOptions = {upsert: true};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tversionOptions = {session, upsert: true};\n\t\t\t\t\t}\n\t\n\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, versionOptions);\n\t\t\t\t\t\n\t\t\t\t\tif (doc.__v >= 4) {\n\t\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).deleteMany(<any>{$and: [{'_id._id': doc._id}, {'_id.__v': {$lt: doc.__v - 4}}]}, sessionOptions);\n\t\t\t\t\t}\n\t\n\t\t\t\t\tif (!objectContainsPropertyDeep(update, '__v')) {\n\t\t\t\t\t\tif (!update.$inc) {\n\t\t\t\t\t\t\tupdate.$inc = {__v: 1};\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (!update.$inc.__v) {\n\t\t\t\t\t\t\tupdate.$inc.__v = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tlet monitor = MonitorMongo.create('updateMany', this.collectionName, JSON.stringify([filter, update, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateMany(<any>filter, update, options);\n\t\t\tif (res.acknowledged) {\n\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t}\n\n\t\t\t\treturn res.modifiedCount;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new Error(`Error in updateMany: ${res}`);\n\t\t\t}\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Update Many', this.collectionName, filter, update, safeOptions, err);\n\t\t\terr.message = `Error in Update Many: ${this.collectionName} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync updateOne(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T>, update: MongoManagerUpdateFilter<T>, options?: UpdateOptions, bypassLogs = false, bypassCheckSchema = false, bypassSession = false) : Promise<number> {\n\t\tif (this.checkSchema && !bypassCheckSchema) {\n\t\t\tconst validation = this.simplschema.newContext();\t\t\t\n\t\t\tconst isValid = validation.validate(update, {modifier: true});\n\n\t\t\tif (!isValid) {\n\t\t\t\tconsole.log(new Date(), this.collectionName, 'Schema Errors - updateOne', validation.validationErrors());\n\t\t\t\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on updateOne - ' + this.collectionName, [validation.validationErrors(), update]);\n\t\t\t\tthrow validation.validationErrors();\n\t\t\t}\n\t\t}\n\n\t\tif ((!update.$inc || JSON.stringify(update.$inc) === '{}') && (!update.$set || JSON.stringify(update.$set) === '{}') && (!update.$setOnInsert || JSON.stringify(update.$setOnInsert) === '{}') && (!update.$unset || JSON.stringify(update.$unset) === '{}')) {\n\t\t\treturn 1;\n\t\t}\n\n\t\tlet date = new Date();\n\n\t\tif (this.timestamps) {\n\t\t\tif (!update.$set) {\n\t\t\t\tupdate.$set = <any>{updatedAt: date};\n\t\t\t}\n\t\t\telse {\n\t\t\t\tupdate.$set.updatedAt = date;\n\t\t\t}\n\t\t}\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\t\t\n\t\tif (this.useVersions) {\n\t\t\tlet doc = await this.findOne(filter, null, true);\n\n\t\t\tif (doc) {\n\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t) {\n\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, update, safeOptions])) < 200000 ? JSON.stringify([doc, filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'updateOne',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, update, safeOptions])) < 200000 ? JSON.stringify([doc, filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\tmethod: 'updateOne',\n\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tlet versionDoc = deepCopy(doc);\n\t\t\t\tversionDoc._id = {_id: doc._id, __v: doc.__v};\n\n\t\t\t\tlet versionOptions = null;\n\t\t\t\tif (!sessionOptions) {\n\t\t\t\t\tversionOptions = {upsert: true};\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tversionOptions = {session, upsert: true};\n\t\t\t\t}\n\n\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, versionOptions);\n\t\t\t\t\n\t\t\t\tif (doc.__v >= 4) {\n\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).deleteMany(<any>{$and: [{'_id._id': doc._id}, {'_id.__v': {$lt: doc.__v - 4}}]}, sessionOptions);\n\t\t\t\t}\n\n\t\t\t\tif (!objectContainsPropertyDeep(update, '__v')) {\n\t\t\t\t\tif (!update.$inc) {\n\t\t\t\t\t\tupdate.$inc = {__v: 1};\n\t\t\t\t\t}\n\t\t\t\t\telse if (!update.$inc.__v) {\n\t\t\t\t\t\tupdate.$inc.__v = 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tlet monitor = MonitorMongo.create('updateOne', this.collectionName, JSON.stringify([filter, update, safeOptions]));\n\n\t\t\t\ttry {\n\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateOne(<any>filter, update, options);\n\t\t\t\t\tif (res.acknowledged) {\n\t\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn res.modifiedCount;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tthrow new Error(`Error in Update One: ${this.collectionName} - ${JSON.stringify(res, null, 2)}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(new Date(), 'Error Update One', this.collectionName, filter, update, safeOptions, err);\n\t\t\t\t\terr.message = `Error in Update One: ${this.collectionName} - ${err.message}`;\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t\tfinally {\n\t\t\t\t\tawait monitor.finish();\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (options && options.upsert) {\n\t\t\t\tif (!update.$setOnInsert) {\n\t\t\t\t\tif (this.timestamps) {\n\t\t\t\t\t\tupdate.$setOnInsert = <any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t__v: 0,\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tupdate.$setOnInsert = <any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t__v: 0\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (!update.$setOnInsert._id) {\n\t\t\t\t\t\tupdate.$setOnInsert._id = objectIdHexString();\n\t\t\t\t\t}\n\n\t\t\t\t\tif (this.timestamps && !update.$setOnInsert.createdAt) {\n\t\t\t\t\t\tupdate.$setOnInsert.createdAt = new Date();\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t) {\n\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: update.$setOnInsert._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['upsert', filter, update, safeOptions])) < 200000 ? JSON.stringify(['upsert', filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'updateOne',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\tid_document: update.$setOnInsert._id,\n\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['upsert', filter, update, safeOptions])) < 200000 ? JSON.stringify(['upsert', filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\tmethod: 'updateOne',\n\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tlet monitor = MonitorMongo.create('updateOne', this.collectionName, JSON.stringify([filter, update, safeOptions]));\n\n\t\t\t\ttry {\n\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateOne(<any>filter, update, options);\n\t\t\t\t\tif (res.acknowledged) {\n\t\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn res.modifiedCount;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tthrow new Error(`Error in Update One: ${this.collectionName} - ${JSON.stringify(res, null, 2)}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(new Date(), 'Error Update One', this.collectionName, filter, update, safeOptions, err);\n\t\t\t\t\terr.message = `Error in Update One: ${this.collectionName} - ${err.message}`;\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t\tfinally {\n\t\t\t\t\tawait monitor.finish();\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new Error('Error in Update One: No Document');\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tif (options && options.upsert) {\n\t\t\t\tif (!update.$setOnInsert) {\n\t\t\t\t\tif (this.timestamps) {\n\t\t\t\t\t\tupdate.$setOnInsert = <any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tupdate.$setOnInsert = <any>{\n\t\t\t\t\t\t\t_id: objectIdHexString()\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (!update.$setOnInsert._id) {\n\t\t\t\t\t\tupdate.$setOnInsert._id = objectIdHexString();\n\t\t\t\t\t}\n\n\t\t\t\t\tif (this.timestamps && !update.$setOnInsert.createdAt) {\n\t\t\t\t\t\tupdate.$setOnInsert.createdAt = new Date();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\tif (!options) {\n\t\t\t\t\toptions = <FindOneAndUpdateOptions>{returnDocument: 'before'};\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t(<FindOneAndUpdateOptions>options).returnDocument = 'before';\n\t\t\t\t}\n\n\t\t\t\tlet monitor = MonitorMongo.create('findOneAndUpdate', this.collectionName, JSON.stringify([filter, update, safeOptions]));\n\n\t\t\t\ttry {\n\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).findOneAndUpdate(<any>filter, update, <FindOneAndUpdateOptions>options);\n\t\t\t\t\tlet doc = res.value;\n\n\t\t\t\t\tif (doc) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: <any>doc._id,\n\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, update, safeOptions])) < 200000 ? JSON.stringify([doc, filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: 'updateOne',\n\t\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: <any>doc._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, update, safeOptions])) < 200000 ? JSON.stringify([doc, filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'updateOne',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn res.ok;\n\t\t\t\t\t}\n\t\t\t\t\telse if (update.$setOnInsert) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: update.$setOnInsert._id,\n\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['upsert', filter, update, safeOptions])) < 200000 ? JSON.stringify(['upsert', filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: 'updateOne',\n\t\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: update.$setOnInsert._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['upsert', filter, update, safeOptions])) < 200000 ? JSON.stringify(['upsert', filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'updateOne',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn res.ok;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(new Date(), 'Error Update One (Find One And Update)', this.collectionName, filter, update, safeOptions, err);\n\t\t\t\t\terr.message = `Error in Update One (Find One And Update): ${this.collectionName} - ${err.message}`;\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t\tfinally {\n\t\t\t\t\tawait monitor.finish();\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tlet monitor = MonitorMongo.create('updateOne', this.collectionName, JSON.stringify([filter, update, safeOptions]));\n\n\t\t\t\ttry {\n\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateOne(<any>filter, update, options);\n\t\t\t\t\tif (res.acknowledged) {\n\t\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn res.modifiedCount;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tthrow new Error(`Error in Aggregate: ${this.collectionName} - ${JSON.stringify(res, null, 2)}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(new Date(), 'Error Update One', this.collectionName, filter, update, safeOptions, err);\n\t\t\t\t\terr.message = `Error in Aggregate: ${this.collectionName} - ${err.message}`;\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t\tfinally {\n\t\t\t\t\tawait monitor.finish();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t\n\twatchCollection(pipeline = [], options?: ChangeStreamOptions, bypassSession = false): ChangeStream<T> {\n\t\tconst session = ResolveIOServer.getMongoManager().getSession();\n\t\tif (session && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = session;\n\t\t\t}\n\t\t}\n\t\t\n\t\tlet stream = ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).watch(pipeline, options);\n\t\treturn <ChangeStream<T>>stream;\n\t}\n}\n\nexport class MongoManagerUserCollection<T extends CollectionDocument> extends MongoManagerCollection<T> {\n\tstatic create(options: MongoManagerCollectionOptions) {\n\t\tconst mongoManagerCollection = new MongoManagerUserCollection();\n\t\tmongoManagerCollection.initialize(options);\n\t\treturn mongoManagerCollection;\n\t}\n\t\n\tasync authenticate(user: UserModel, password: string): Promise<{data: UserModel, error: string}> {\n\t\tconst attemptsInterval = Math.pow(100, Math.log(user.attempts + 1));\n\t\tconst calculatedInterval = attemptsInterval < 300000 ? attemptsInterval : 300000;\n\t\n\t\tif (user.last) {\n\t\t\tif (Date.now() - user.last.getTime() < calculatedInterval) {\n\t\t\t\tuser.last = new Date();\n\t\t\t\tawait Users.updateOne({_id: user._id}, {$set: {last: user.last}});\n\t\t\t\treturn {\n\t\t\t\t\tdata: null,\n\t\t\t\t\terror: 'Attempt Too Soon'\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tuser.last = new Date();\n\t\t}\n\t\n\t\tif (user.attempts >= 5) {\n\t\t\treturn {\n\t\t\t\tdata: null,\n\t\t\t\terror: 'Too Many Attempts'\n\t\t\t};\n\t\t}\n\t\t\n\t\tif (!user.salt) {\n\t\t\treturn {\n\t\t\t\tdata: null,\n\t\t\t\terror: 'No Salt Value Stored'\n\t\t\t};\n\t\t}\n\n\t\ttry {\n\t\t\tlet hashBuffer = await pbkdf2Promisified(password, user.salt, {\n\t\t\t\titerations: 25000,\n\t\t\t\tkeylen: 512,\n\t\t\t\tdigestAlgorithm: 'sha256'\n\t\t\t});\n\n\t\t\tif (scmp(hashBuffer, Buffer.from(user.hash, 'hex'))) {\n\t\t\t\tuser.last = new Date();\n\t\t\t\tuser.attempts = 0;\n\t\t\t\tawait Users.updateOne({_id: user._id}, {$set: {last: user.last, attempts: user.attempts}});\n\n\t\t\t\treturn {\n\t\t\t\t\tdata: user,\n\t\t\t\t\terror: ''\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\tuser.last = new Date();\n\t\t\t\tuser.attempts = user.attempts + 1;\n\t\t\t\tawait Users.updateOne({_id: user._id}, {$set: {last: user.last, attempts: user.attempts}});\n\n\t\t\t\tif (user.attempts >= 5) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdata: null,\n\t\t\t\t\t\terror: 'Too Many Attempts'\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdata: null,\n\t\t\t\t\t\terror: 'Invalid Username And Password'\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tcatch (err) {\n\t\t\terr.message = `Error in User Authenticate: ${JSON.stringify(user, null, 2)} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t}\n\n\tserializeUser() {\n\t\treturn (user, cb) => {\n\t\t\tcb(null, user.username);\n\t\t};\n\t}\n\n\tdeserializeUser() {\n\t\treturn async (username) => {\n\t\t\treturn Users.findOne({username: username});\n\t\t};\n\t}\n\n\tasync setPassword(user: UserModel, password: string) {\n\t\tif (!user) {\n\t\t\tthrow new Error('Error In User Set Password: No User');\n\t\t}\n\t\telse if (!password) {\n\t\t\tthrow new Error('Error In User Set Password: No Password');\n\t\t}\n\t\telse {\n\t\t\tlet saltBuffer = await randomBytes(32);\n\t\t\tlet salt = saltBuffer.toString('hex');\n\t\t\ttry {\n\t\t\t\tlet hashRaw = await pbkdf2Promisified(password, salt, {\n\t\t\t\t\titerations: 25000,\n\t\t\t\t\tkeylen: 512,\n\t\t\t\t\tdigestAlgorithm: 'sha256'\n\t\t\t\t});\n\t\t\t\tlet hash = Buffer.from(hashRaw, 'binary').toString('hex');\n\t\t\t\t\n\t\t\t\treturn Users.updateOne({_id: user._id}, {$set: {hash: hash, salt: salt, services: {}, attempts: 0}});\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\terr.message = `Error in User Set Password: ${JSON.stringify(user, null, 2)} - ${err.message}`;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t}\n\t};\n\n\tasync changePassword(user, oldPassword, newPassword) {\n\t\tif (!user) {\n\t\t\tthrow new Error('Error in User Change Password: Missing User');\n\t\t}\n\t\telse if (!oldPassword || !newPassword) {\n\t\t\tthrow new Error('Error in User Change Password: Missing Password');\n\t\t}\n\t\telse {\n\t\t\tlet authUser = await this.authenticate(user, oldPassword);\n\n\t\t\tif (!authUser['data']) {\n\t\t\t\tthrow authUser['error'];\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn this.setPassword(user, newPassword);\n\t\t\t}\n\t\t}\n\t}\n\t\n\tasync register(user, password) {\n\t\tif (!user.username) {\n\t\t\tthrow new Error('Error in User Register: Missing Username');\n\t\t}\n\t\telse {\n\t\t\tlet dbUser = await Users.findOne({username: user.username});\n\t\t\t\n\t\t\tif (dbUser) {\n\t\t\t\tthrow new Error('Error in User Register: Username Exists');\n\t\t\t}\n\t\t\telse {\n\t\t\t\tdbUser = await Users.findOne({email: user.email});\n\n\t\t\t\tif (dbUser) {\n\t\t\t\t\tthrow new Error('Error in User Register: Email Exists');\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tuser.setPassword(password);\n\t\t\t\t\treturn user;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tresetAttempts(user: UserModel) {\n\t\treturn Users.updateOne({_id: user._id}, {$set: {attempts: 0}});\n\t}\n}\n\nfunction pbkdf2(password, salt, options, callback) {\n\tcrypto.pbkdf2(password, salt, options.iterations, options.keylen, options.digestAlgorithm, callback);\n};\n\nfunction pbkdf2Promisified(password, salt, options): Promise<any> {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn new Promise((resolve, reject) => pbkdf2(password, salt, options, (err, hashRaw) => (err ? reject(err) : resolve(hashRaw))));\n}\n\nfunction randomBytes(saltlen): Promise<Buffer> {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn new Promise((resolve, reject) => crypto.randomBytes(saltlen, (err, saltBuffer) => (err ? reject(err) : resolve(saltBuffer))));\n}\n\nfunction objectContainsPropertyDeep(obj: Object, prop: string) {\n\tlet keys = Object.keys(obj);\n\n\tif (keys.some(a => a === prop)) {\n\t\treturn true;\n\t}\n\t\n\tfor (let i = 0; i < keys.length; i++) {\n\t\tlet key = keys[i];\n\t\tif (obj[key] && typeof obj[key] === 'object' && objectContainsPropertyDeep(obj[key], prop)) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}"]}
|