@resolveio/server-lib 20.7.116 → 20.7.118
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.
- package/managers/mongo.manager.d.ts +1 -0
- package/managers/mongo.manager.js.map +1 -1
- package/managers/worker-dispatcher.manager.js +1 -1
- package/managers/worker-dispatcher.manager.js.map +1 -1
- package/managers/worker-server.manager.js +1 -1
- package/managers/worker-server.manager.js.map +1 -1
- package/package.json +1 -1
- package/util/common.d.ts +1 -0
- package/util/common.js +1 -1
- package/util/common.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/managers/mongo.manager.ts"],"names":["NodeCache","require","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","code","err_1","codeName","message","stack","concat","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","readPreference","err_5","aggregateCount","err_6","aggregateCursor","cursor","ev","aggregateStream","streamOptions","stream","bulkWrite","operations","bypassCheckSchema","bypassLogs","bypassVersions","BATCH_SIZE","opIndex","batchOps","slice","logs","versionOps","e_4","batchOps_1","batchOps_1_1","op","opType","Object","doc","validationContext","newContext","isValid","validate","document","replacement","modifier","Error","validationErrors","createdAt","updatedAt","objectIdHexString","id_document","payload","method","id_user","user","messageId","route","$set","$inc","__v","affectedDocs","versionFilters","map","v","$or","_f","versionInserts","insertOne","__assign","err_7","getServerConfig","getLocalLogManager","writeLogs","bwOptions","ordered","affectedDocIds","$in","$sort","$group","versions","$push","$project","versionsToDelete","$slice","$size","$unwind","$replaceRoot","newRoot","oldVersions","deleteMany","ok","estimatedDocumentCount","err_8","f_docs","Array","isArray","insertMany","fieldOrSpec","dbCollection","indexes","existingIndexes","index","createIndexes","indexSpecs","existingIndexes_1","indexSpec","existingIndex","docs","i","writeLog","versionDoc","replaceOne","upsert","$lt","res","err_9","deleteOne","err_10","err_11","distinct","err_12","drop","err_13","dropIndex","indexName","err_14","dropIndexes","err_15","err_16","findById","id","err_17","findCount","count","err_18","findCursor","removeAllListeners","findStream","err_19","findOneAndDelete","err_20","findOneAndReplace","validation","getMethodManager","callMethod","date","err_21","findOneAndUpdate","$setOnInsert","err_22","err_23","indexExists","err_24","bypassMonitor","validationResults","docs_1","docs_1_1","validDocs","idx","hasOwnProperty","err_25","err_26","listIndexes","rename","newName","err_27","err_28","prevDoc","docId","docVersion","updatedDoc","getMongoMergeUpdatedDoc","acknowledged","err_29","err_30","matchedCount","modifiedCount","upsertedCount","upsertedId","returnDocument","session_1","safeOptions_1","doc_1","err_31","err_32","updateMany","isEmptyUpdate","$unset","$pull","$addToSet","$min","$max","$currentDate","$mul","$rename","values","every","err_33","updateOne","err_34","err_35","err_36","err_37","watchCollection","_super","__extends","authenticate","password","attemptsInterval","Math","pow","attempts","calculatedInterval","last","now","getTime","Users","error","salt","pbkdf2Promisified","iterations","keylen","digestAlgorithm","hashBuffer","Buffer","hash","err_38","serializeUser","cb","username","deserializeUser","setPassword","randomBytes","saltBuffer","toString","hashRaw","services","err_39","changePassword","oldPassword","newPassword","authUser","register","email","resetAttempts","pbkdf2","callback","reject","err","saltlen"],"mappings":"02GACAA,W,+KAAAC,QAAA,YAAA,GACAC,KAAAD,QAAA,IAAA,EACAE,eAAAF,QAAA,cAAA,EACAG,kBAAAH,QAAA,gCAAA,EAIAI,uBAAAJ,QAAA,yBAAA,EACAK,SAAAL,QAAA,gBAAA,EACAM,kBAAAN,QAAA,mBAAA,EACMO,OAASP,QAAQ,QAAQ,EACzBQ,KAAOR,QAAQ,MAAM,EACrBS,SAAU,EAAAR,KAAAS,MAAI,EAAGC,OACjBC,GAAKZ,QAAQ,IAAI,EACfa,kBAAsBb,QAAQ,aAAa,EAACa,kBAC9CC,kBAAoB,IAAID,kBA+G9BE,aAAA,WAWC,SAAAA,eAVQC,KAAAC,aAA6D,GAE7DD,KAAAE,UAAsD,GACtDF,KAAAG,qBAA2H,IAAIC,IAC/HJ,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,EAAUW,EAAMhW,EAAS,SAAC8X,EAAKb,GAAY,OAACa,EAAMD,EAAOC,CAAG,EAAIjY,EAAQoX,CAAO,CAApC,CAAsC,CAAxF,CAAyF,CAClI,CAEA,SAASH,YAAYiB,GAEpB,OAAO,IAAInY,QAAQ,SAACC,EAASgY,GAAW,OAAAxc,OAAOyb,YAAYiB,EAAS,SAACD,EAAKf,GAAe,OAACe,EAAMD,EAAOC,CAAG,EAAIjY,EAAQkX,CAAU,CAAvC,CAAyC,CAA1F,CAA2F,CACpI,CApLa1Q,QAAAK,2BAAAA","file":"mongo.manager.js","sourcesContent":["import { AggregateOptions, AggregationCursor, BulkWriteOptions, BulkWriteResult, ChangeStream, ChangeStreamOptions, Collection, CollectionInfo, CommandOperationOptions, CountDocumentsOptions, CreateCollectionOptions, CreateIndexesOptions, CursorStreamOptions, DeleteOptions, DeleteResult, FindCursor, FindOneAndDeleteOptions, FindOneAndReplaceOptions, FindOneAndUpdateOptions, FindOptions, IndexDescription, IndexInformationOptions, InsertOneOptions, ListIndexesCursor, ListIndexesOptions, OptionalUnlessRequiredId, RenameOptions, ReplaceOptions, UpdateOptions, UpdateResult } 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 MongoManagerRenameFilter<T> = {\n\t// eslint-disable-next-line no-unused-vars\n\t[P in keyof T]?: string;\n};\n\nexport declare type MongoManagerArrayFilter<T> = {\n\t// eslint-disable-next-line no-unused-vars\n\t[P in keyof T]?: any; // can refine if needed\n};\n\nexport declare type MongoManagerCurrentDateFilter<T> = {\n\t// eslint-disable-next-line no-unused-vars\n\t[P in keyof T]?: true | { $type: 'date' | 'timestamp' };\n};\n\nexport declare type MongoManagerUpdateFilter<T> = {\n\t$set?: MongoManagerFilter<T> | Document;\n\t$unset?: MongoManagerUnsetFilter<T> | Document;\n\t$inc?: MongoManagerIncFilter<T> | Document;\n\t$setOnInsert?: MongoManagerFilter<T> | Document;\n\t$push?: MongoManagerArrayFilter<T> | Document;\n\t$pull?: MongoManagerArrayFilter<T> | Document;\n\t$addToSet?: MongoManagerArrayFilter<T> | Document;\n\t$min?: MongoManagerIncFilter<T> | Document;\n\t$max?: MongoManagerIncFilter<T> | Document;\n\t$currentDate?: MongoManagerCurrentDateFilter<T> | Document;\n\t$mul?: MongoManagerIncFilter<T> | Document;\n\t$rename?: MongoManagerRenameFilter<T>;\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\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\tconsole.log(JSON.stringify([new Date(), 'Error Execute Find', collectionName, filter, safeOptions, {\n\t\t\t\tcode: err.code,\n\t\t\t\tcodeName: err.codeName,\n\t\t\t\tmessage: err.message,\n\t\t\t\tstack: err.stack\n\t\t\t}], null, 2));\n\n\t\t\terr.message = `Error in Execute Find: ${collectionName} => ${err.codeName || 'NoCodeName'} => ${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\tconsole.log(JSON.stringify([new Date(), 'Error Execute Find One', collectionName, filter, safeOptions, {\n\t\t\t\tcode: err.code,\n\t\t\t\tcodeName: err.codeName,\n\t\t\t\tmessage: err.message,\n\t\t\t\tstack: err.stack\n\t\t\t}], null, 2));\n\n\t\t\terr.message = `Error in Execute Find One: ${collectionName} => ${err.codeName || 'NoCodeName'} => ${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\tconsole.log(JSON.stringify([new Date(), 'Error Execute Aggregate', collectionName, pipeline, collections, safeOptions, {\n\t\t\t\tcode: err.code,\n\t\t\t\tcodeName: err.codeName,\n\t\t\t\tmessage: err.message,\n\t\t\t\tstack: err.stack\n\t\t\t}], null, 2));\n\n\t\t\terr.message = `Error in Execute Aggregate: ${collectionName} => ${err.codeName || 'NoCodeName'} => ${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\tconsole.log(JSON.stringify([new Date(), 'Error Execute Count Documents', collectionName, filter, safeOptions, {\n\t\t\t\tcode: err.code,\n\t\t\t\tcodeName: err.codeName,\n\t\t\t\tmessage: err.message,\n\t\t\t\tstack: err.stack\n\t\t\t}], null, 2));\n\n\t\t\terr.message = `Error in Execute Count Documents: ${collectionName} => ${err.codeName || 'NoCodeName'} => ${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} \n\t\tcatch {\n\t\t\tthis._nodeCache.del(cacheKey);\n\t\t}\n\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\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 && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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(JSON.stringify([new Date(), 'Error Aggregate', this.collectionName, pipeline, safeOptions, {\n\t\t\t\t\tcode: err.code,\n\t\t\t\t\tcodeName: err.codeName,\n\t\t\t\t\tmessage: err.message,\n\t\t\t\t\tstack: err.stack\n\t\t\t\t}], null, 2));\n\t\n\t\t\t\terr.message = `Error in Aggregate: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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 && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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(JSON.stringify([new Date(), 'Error Aggregate Count', this.collectionName, pipeline, safeOptions, {\n\t\t\t\tcode: err.code,\n\t\t\t\tcodeName: err.codeName,\n\t\t\t\tmessage: err.message,\n\t\t\t\tstack: err.stack\n\t\t\t}], null, 2));\n\n\t\t\terr.message = `Error in Aggregate Count: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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 && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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 && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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\n\t\tlet { session, ...safeOptions } = options || {};\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(), null, 2)}`\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\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.document._id || objectIdHexString(),\n\t\t\t\t\t\t\tpayload:\n\t\t\t\t\t\t\t\tgetBinarySize(JSON.stringify(doc.document)) < 1000000\n\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: 'Too Big',\n\t\t\t\t\t\t\tmethod: 'insertOne',\n\t\t\t\t\t\t\tid_user: '', // Add user info if available\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\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\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.filter._id || null,\n\t\t\t\t\t\t\tpayload:\n\t\t\t\t\t\t\t\tgetBinarySize(JSON.stringify(doc.update)) < 1000000\n\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: 'Too Big',\n\t\t\t\t\t\t\tmethod: opType,\n\t\t\t\t\t\t\tid_user: '', // Add user info if available\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\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\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.filter._id || null,\n\t\t\t\t\t\t\tpayload:\n\t\t\t\t\t\t\t\tgetBinarySize(JSON.stringify(doc.replacement)) < 1000000\n\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: 'Too Big',\n\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\tid_user: '', // Add user info if available\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\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\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.filter._id || null,\n\t\t\t\t\t\t\tpayload:\n\t\t\t\t\t\t\t\tgetBinarySize(JSON.stringify(doc.filter)) < 1000000\n\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: 'Too Big',\n\t\t\t\t\t\t\tmethod: opType,\n\t\t\t\t\t\t\tid_user: '', // Add user info if available\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\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\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\n\t\t\t\t\tif (versionFilters.length) {\n\t\t\t\t\t\taffectedDocs = await ResolveIOServer.getMainDB().collection(this.collectionName).find({ $or: versionFilters }, {session}).toArray();\n\t\t\t\t\t}\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\ttry {\n\t\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection(this.versionCollection).bulkWrite(<any>versionInserts);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch {}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch {}\n\t\t\t}\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\tconsole.log(JSON.stringify([new Date(), 'Error Bulk Write', this.collectionName, operations, safeOptions, {\n\t\t\t\t\tcode: err.code,\n\t\t\t\t\tcodeName: err.codeName,\n\t\t\t\t\tmessage: err.message,\n\t\t\t\t\tstack: err.stack\n\t\t\t\t}], null, 2));\n\t\n\t\t\t\terr.message = `Error in Bulk Write: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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\tbwOptions = {session, ordered: false};\n\n\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').bulkWrite(logs.map(a => {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tinsertOne: {\n\t\t\t\t\t\t\t\tdocument: a\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\t\t\t\t\t}), bwOptions);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!bypassVersions && this.useVersions) {\n\t\t\t\ttry {\n\t\t\t\t\t// Delete old versions beyond the latest 5\n\t\t\t\t\tconst affectedDocIds = affectedDocs.map((doc) => doc._id);\n\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\t\t\t\n\t\t\t\t\tconst oldVersions = await ResolveIOServer.getMainDB().collection(this.versionCollection).aggregate(pipeline).toArray();\n\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) } });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch {}\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): Promise<number> {\n\t\t\n\t\t// ********* COUNTS ARE NOT SUPPORTED IN MONGO SESSIONS! ***************\n\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(safeOptions);\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, safeOptions);\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, safeOptions);\n\t\t\t\treturn res;\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tconsole.log(JSON.stringify([new Date(), 'Error Count Documents', this.collectionName, filter, safeOptions, {\n\t\t\t\t\tcode: err.code,\n\t\t\t\t\tcodeName: err.codeName,\n\t\t\t\t\tmessage: err.message,\n\t\t\t\t\tstack: err.stack\n\t\t\t\t}], null, 2));\n\t\n\t\t\t\terr.message = `Error in Count Documents: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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\t// Check if index already exists based on the key\n\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// 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\treturn dbCollection.createIndex(fieldOrSpec, options);\n\t\t}\n\t\tcatch {}\n\t\t\n\t\treturn 'Index creation queued';\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\treturn dbCollection.createIndexes(indexSpecs, options);\n\t\t}\n\t\tcatch {}\n\n\t\treturn ['Index creation queued'];\n\t}\n\t\n\tasync deleteMany(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {}, options?: DeleteOptions, bypassLogs = false, bypassSession = false): Promise<DeleteResult> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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\tlet { session, ...safeOptions } = options || {};\n\n\t\tif ((this.createLogs && !bypassLogs) || this.useVersions) {\n\t\t\tlet docs = await this.find(filter, {session});\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])) < 1000000 ? 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])) < 1000000 ? 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}, {session});\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.useVersions) {\n\t\t\t\t\ttry {\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\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, {upsert: true});\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}}]});\n\t\t\t\t\t}\n\t\t\t\t\tcatch {}\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 (!this.skipCache) {\n\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t}\n\n\t\t\treturn res;\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(JSON.stringify([new Date(), 'Error Delete Many', this.collectionName, filter, safeOptions, {\n\t\t\t\tcode: err.code,\n\t\t\t\tcodeName: err.codeName,\n\t\t\t\tmessage: err.message,\n\t\t\t\tstack: err.stack\n\t\t\t}], null, 2));\n\n\t\t\terr.message = `Error in Delete Many: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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<DeleteResult> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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\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 res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).deleteOne(<any>filter, options);\n\t\t\t\tlet doc = await this.findOne(filter, options);\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])) < 1000000 ? 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])) < 1000000 ? 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}, {session});\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\ttry {\n\t\t\t\t\t\t\tlet versionDoc = deepCopy(doc);\n\t\t\t\t\t\t\tversionDoc._id = {_id: doc._id, __v: doc.__v};\n\n\t\t\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, {upsert: true});\n\t\t\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).deleteMany(<any>{$and: [{'_id._id': doc._id}, {'_id.__v': {$lt: doc.__v - 1}}]});\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch {}\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\t\t\t\t}\n\n\t\t\t\treturn res;\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tconsole.log(JSON.stringify([new Date(), 'Error Delete One (Find One And Delete)', this.collectionName, filter, safeOptions, {\n\t\t\t\t\tcode: err.code,\n\t\t\t\t\tcodeName: err.codeName,\n\t\t\t\t\tmessage: err.message,\n\t\t\t\t\tstack: err.stack\n\t\t\t\t}], null, 2));\n\t\n\t\t\t\terr.message = `Error in Delete One (Find One And Delete): ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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 (!this.skipCache) {\n\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t}\n\t\t\t\treturn res;\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tconsole.log(JSON.stringify([new Date(), 'Error Delete One', this.collectionName, filter, safeOptions, {\n\t\t\t\t\tcode: err.code,\n\t\t\t\t\tcodeName: err.codeName,\n\t\t\t\t\tmessage: err.message,\n\t\t\t\t\tstack: err.stack\n\t\t\t\t}], null, 2));\n\t\n\t\t\t\terr.message = `Error in Delete One: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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 && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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(JSON.stringify([new Date(), 'Error Distinct', this.collectionName, filter, safeOptions, {\n\t\t\t\tcode: err.code,\n\t\t\t\tcodeName: err.codeName,\n\t\t\t\tmessage: err.message,\n\t\t\t\tstack: err.stack\n\t\t\t}], null, 2));\n\n\t\t\terr.message = `Error in Distinct: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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 && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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(JSON.stringify([new Date(), 'Error Drop Collection', this.collectionName, safeOptions, {\n\t\t\t\tcode: err.code,\n\t\t\t\tcodeName: err.codeName,\n\t\t\t\tmessage: err.message,\n\t\t\t\tstack: err.stack\n\t\t\t}], null, 2));\n\n\t\t\terr.message = `Error in Drop Collection: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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 && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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(JSON.stringify([new Date(), 'Error Drop Index', this.collectionName, indexName, safeOptions, {\n\t\t\t\tcode: err.code,\n\t\t\t\tcodeName: err.codeName,\n\t\t\t\tmessage: err.message,\n\t\t\t\tstack: err.stack\n\t\t\t}], null, 2));\n\n\t\t\terr.message = `Error in Drop Index: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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 && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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(JSON.stringify([new Date(), 'Error Drop Indexes', this.collectionName, safeOptions, {\n\t\t\t\tcode: err.code,\n\t\t\t\tcodeName: err.codeName,\n\t\t\t\tmessage: err.message,\n\t\t\t\tstack: err.stack\n\t\t\t}], null, 2));\n\n\t\t\terr.message = `Error in Drop Indexes: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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 && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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\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(JSON.stringify([new Date(), 'Error Find', this.collectionName, filter, safeOptions, {\n\t\t\t\t\tcode: err.code,\n\t\t\t\t\tcodeName: err.codeName,\n\t\t\t\t\tmessage: err.message,\n\t\t\t\t\tstack: err.stack\n\t\t\t\t}], null, 2));\n\t\n\t\t\t\terr.message = `Error in Find: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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 && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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(JSON.stringify([new Date(), 'Error Find By ID', this.collectionName, id, safeOptions, {\n\t\t\t\t\tcode: err.code,\n\t\t\t\t\tcodeName: err.codeName,\n\t\t\t\t\tmessage: err.message,\n\t\t\t\t\tstack: err.stack\n\t\t\t\t}], null, 2));\n\t\n\t\t\t\terr.message = `Error in Find By ID: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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 && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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(JSON.stringify([new Date(), 'Error Find Count', this.collectionName, filter, safeOptions, {\n\t\t\t\tcode: err.code,\n\t\t\t\tcodeName: err.codeName,\n\t\t\t\tmessage: err.message,\n\t\t\t\tstack: err.stack\n\t\t\t}], null, 2));\n\n\t\t\terr.message = `Error in Find Count: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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 && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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 && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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 && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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(JSON.stringify([new Date(), 'Error Find One', this.collectionName, filter, safeOptions, {\n\t\t\t\t\tcode: err.code,\n\t\t\t\t\tcodeName: err.codeName,\n\t\t\t\t\tmessage: err.message,\n\t\t\t\t\tstack: err.stack\n\t\t\t\t}], null, 2));\n\t\n\t\t\t\terr.message = `Error in Find One: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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\tif (mongoSession && !bypassSession && !this.bypassSession && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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\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])) < 1000000 ? 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])) < 1000000 ? 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}, {session});\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.useVersions) {\n\t\t\t\t\ttry {\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\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, {upsert: true});\n\t\t\t\t\t}\n\t\t\t\t\tcatch {}\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(JSON.stringify([new Date(), 'Error Find One And Delete', this.collectionName, filter, safeOptions, {\n\t\t\t\tcode: err.code,\n\t\t\t\tcodeName: err.codeName,\n\t\t\t\tmessage: err.message,\n\t\t\t\tstack: err.stack\n\t\t\t}], null, 2));\n\n\t\t\terr.message = `Error in Find One And Delete: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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\tawait ResolveIOServer.getMainServer().getMethodManager().callMethod('insertErrorLog', 'Schema Failed on findOneAndReplace - ' + this.collectionName, JSON.stringify([validation.validationErrors(), replacement], null, 2));\n\t\t\t\tthrow new Error(JSON.stringify(validation.validationErrors(), null, 2));\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\tif (mongoSession && !bypassSession && !this.bypassSession && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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\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])) < 1000000 ? 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])) < 1000000 ? 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}, {session});\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.useVersions) {\n\t\t\t\t\ttry {\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\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, {upsert: true});\n\t\t\t\t\t}\n\t\t\t\t\tcatch {}\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(JSON.stringify([new Date(), 'Error Find One And Replace', this.collectionName, filter, safeOptions, {\n\t\t\t\tcode: err.code,\n\t\t\t\tcodeName: err.codeName,\n\t\t\t\tmessage: err.message,\n\t\t\t\tstack: err.stack\n\t\t\t}], null, 2));\n\n\t\t\terr.message = `Error in Find One And Replace: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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\tawait ResolveIOServer.getMainServer().getMethodManager().callMethod('insertErrorLog', 'Schema Failed on findOneAndUpdate - ' + this.collectionName, JSON.stringify([validation.validationErrors(), update], null, 2));\n\t\t\t\tthrow new Error(JSON.stringify(validation.validationErrors(), null, 2));\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\tif (mongoSession && !bypassSession && !this.bypassSession && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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\n\t\t \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])) < 1000000 ? 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])) < 1000000 ? 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}, {session});\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.useVersions) {\n\t\t\t\t\ttry {\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\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, {upsert: true});\n\t\t\t\t\t}\n\t\t\t\t\tcatch {}\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(JSON.stringify([new Date(), 'Error Find One And Update', this.collectionName, filter, safeOptions, {\n\t\t\t\tcode: err.code,\n\t\t\t\tcodeName: err.codeName,\n\t\t\t\tmessage: err.message,\n\t\t\t\tstack: err.stack\n\t\t\t}], null, 2));\n\n\t\t\terr.message = `Error in Find One And Update: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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): Promise<any[]> {\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(JSON.stringify([new Date(), 'Error Indexes', this.collectionName, safeOptions, {\n\t\t\t\tcode: err.code,\n\t\t\t\tcodeName: err.codeName,\n\t\t\t\tmessage: err.message,\n\t\t\t\tstack: err.stack\n\t\t\t}], null, 2));\n\n\t\t\terr.message = `Error in Indexes: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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): Promise<boolean> {\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(JSON.stringify([new Date(), 'Error Index Exists', this.collectionName, indexes, safeOptions, {\n\t\t\t\tcode: err.code,\n\t\t\t\tcodeName: err.codeName,\n\t\t\t\tmessage: err.message,\n\t\t\t\tstack: err.stack\n\t\t\t}], null, 2));\n\n\t\t\terr.message = `Error in Index Exists: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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\tfor (let doc of docs) {\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\tawait ResolveIOServer.getMainServer().getMethodManager().callMethod('insertErrorLog', 'Schema Failed on insertMany - ' + this.collectionName, JSON.stringify([validation.validationErrors(), doc], null, 2));\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\tif (mongoSession && !bypassSession && !this.bypassSession && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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\n\t\t \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])) < 1000000 ? 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])) < 1000000 ? 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}, {session});\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\tawait ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).insertMany(<OptionalUnlessRequiredId<T>[]>validDocs, options);\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 validDocs;\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tconsole.log(JSON.stringify([new Date(), 'Error Insert Many', this.collectionName, docs, safeOptions, {\n\t\t\t\t\tcode: err.code,\n\t\t\t\t\tcodeName: err.codeName,\n\t\t\t\t\tmessage: err.message,\n\t\t\t\t\tstack: err.stack\n\t\t\t\t}], null, 2));\n\t\n\t\t\t\terr.message = `Error in Insert Many: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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\tawait ResolveIOServer.getMainServer().getMethodManager().callMethod('insertErrorLog', 'Schema Failed on insertOne - ' + this.collectionName, JSON.stringify([validation.validationErrors(), doc], null, 2));\n\t\t\t\tthrow new Error(JSON.stringify(validation.validationErrors(), null, 2));\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\tif (mongoSession && !bypassSession && !this.bypassSession && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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\n\t\t \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])) < 1000000 ? 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])) < 1000000 ? 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}, {session});\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\tawait ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).insertOne(<OptionalUnlessRequiredId<T>>doc, options);\n\t\t\tif (!this.skipCache) {\n\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t}\n\t\t\t\n\t\t\treturn doc;\n\t\t}\n\t\tcatch(err) {\n\t\t\tconsole.log(JSON.stringify([new Date(), 'Error Insert One', this.collectionName, doc, safeOptions, {\n\t\t\t\tcode: err.code,\n\t\t\t\tcodeName: err.codeName,\n\t\t\t\tmessage: err.message,\n\t\t\t\tstack: err.stack\n\t\t\t}], null, 2));\n\n\t\t\terr.message = `Error in Insert One: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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 && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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 && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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(JSON.stringify([new Date(), 'Error Rename', this.collectionName, newName, safeOptions, {\n\t\t\t\tcode: err.code,\n\t\t\t\tcodeName: err.codeName,\n\t\t\t\tmessage: err.message,\n\t\t\t\tstack: err.stack\n\t\t\t}], null, 2));\n\n\t\t\terr.message = `Error in Rename: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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<UpdateResult> {\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\tawait ResolveIOServer.getMainServer().getMethodManager().callMethod('insertErrorLog', 'Schema Failed on replaceOne - ' + this.collectionName, JSON.stringify([validation.validationErrors(), replacement], null, 2));\n\t\t\t\tthrow new Error(JSON.stringify(validation.validationErrors(), null, 2));\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\tif (mongoSession && !bypassSession && !this.bypassSession && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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\n\t\t \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, {session}, 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\ttry {\n\t\t\t\t\t\treplacement.__v += 1;\n\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\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, {upsert: true});\n\n\t\t\t\t\t\tif (doc.__v >= 4) {\n\t\t\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).deleteMany(<any>{$and: [{'_id._id': doc._id}, {'_id.__v': {$lt: doc.__v - 4}}]});\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcatch {}\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])) < 1000000 ? 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])) < 1000000 ? 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}, {session});\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) as UpdateResult;\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;\n\t\t\t\t\t}\n\t\t\t\t\tcatch (err) {\n\t\t\t\t\t\tconsole.log(JSON.stringify([new Date(), 'Error Replace One', this.collectionName, filter, replacement, safeOptions, {\n\t\t\t\t\t\t\tcode: err.code,\n\t\t\t\t\t\t\tcodeName: err.codeName,\n\t\t\t\t\t\t\tmessage: err.message,\n\t\t\t\t\t\t\tstack: err.stack\n\t\t\t\t\t\t}], null, 2));\n\t\t\t\n\t\t\t\t\t\terr.message = `Error in Replace One: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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])) < 1000000 ? 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])) < 1000000 ? 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}, {session});\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 (!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.acknowledged;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch (err) {\n\t\t\t\t\t\t\tconsole.log(JSON.stringify([new Date(), 'Error Replace One', this.collectionName, filter, replacement, safeOptions, {\n\t\t\t\t\t\t\t\tcode: err.code,\n\t\t\t\t\t\t\t\tcodeName: err.codeName,\n\t\t\t\t\t\t\t\tmessage: err.message,\n\t\t\t\t\t\t\t\tstack: err.stack\n\t\t\t\t\t\t\t}], null, 2));\n\t\t\t\t\n\t\t\t\t\t\t\terr.message = `Error in Replace One: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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 Replace 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])) < 1000000 ? 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])) < 1000000 ? 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}, {session});\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 (!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.acknowledged;\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(JSON.stringify([new Date(), 'Error Replace One', this.collectionName, filter, replacement, safeOptions, {\n\t\t\t\t\t\tcode: err.code,\n\t\t\t\t\t\tcodeName: err.codeName,\n\t\t\t\t\t\tmessage: err.message,\n\t\t\t\t\t\tstack: err.stack\n\t\t\t\t\t}], null, 2));\n\t\t\n\t\t\t\t\terr.message = `Error in Replace One: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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\treturn {\n\t\t\t\t\tacknowledged: false,\n\t\t\t\t\tmatchedCount: 0,\n\t\t\t\t\tmodifiedCount: 0,\n\t\t\t\t\tupsertedCount: 0,\n\t\t\t\t\tupsertedId: null\n\t\t\t\t};\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 \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).replaceOne(<any>filter, replacement, options) as UpdateResult;\n\n\t\t\t\t\tlet doc = await this.findOne(filter, options);\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])) < 1000000 ? 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])) < 1000000 ? 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}, {session});\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])) < 1000000 ? 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])) < 1000000 ? 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}, {session});\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 res;\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(JSON.stringify([new Date(), 'Error Replace One (Find One And Replace)', this.collectionName, filter, safeOptions, {\n\t\t\t\t\t\tcode: err.code,\n\t\t\t\t\t\tcodeName: err.codeName,\n\t\t\t\t\t\tmessage: err.message,\n\t\t\t\t\t\tstack: err.stack\n\t\t\t\t\t}], null, 2));\n\t\t\n\t\t\t\t\terr.message = `Error in Replace One (Find One And Replace): ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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 (!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.acknowledged;\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(JSON.stringify([new Date(), 'Error Replace One', this.collectionName, filter, replacement, safeOptions, {\n\t\t\t\t\t\tcode: err.code,\n\t\t\t\t\t\tcodeName: err.codeName,\n\t\t\t\t\t\tmessage: err.message,\n\t\t\t\t\t\tstack: err.stack\n\t\t\t\t\t}], null, 2));\n\t\t\n\t\t\t\t\terr.message = `Error in Replace One: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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<UpdateResult> {\n\t\tconst isEmptyUpdate = !update.$set && !update.$unset && !update.$inc && !update.$setOnInsert && !update.$push && !update.$pull && !update.$addToSet && !update.$min && !update.$max && !update.$currentDate && !update.$mul && !update.$rename;\n\n\t\tconst allEmpty =\n\t\t\tisEmptyUpdate ||\n\t\t\tObject.values(update).every(op => {\n\t\t\t\treturn !op || JSON.stringify(op) === '{}';\n\t\t\t});\n\n\t\tif (allEmpty) {\n\t\t\treturn {\n\t\t\t\tacknowledged: false,\n\t\t\t\tmatchedCount: 0,\n\t\t\t\tmodifiedCount: 0,\n\t\t\t\tupsertedCount: 0,\n\t\t\t\tupsertedId: null\n\t\t\t};\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\tawait ResolveIOServer.getMainServer().getMethodManager().callMethod('insertErrorLog', 'Schema Failed on updateMany - ' + this.collectionName, JSON.stringify([validation.validationErrors(), update], null, 2));\n\t\t\t\tthrow new Error(JSON.stringify(validation.validationErrors(), null, 2));\n\t\t\t}\n\t\t}\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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\n\t\t \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, {session});\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])) < 1000000 ? 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])) < 1000000 ? 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}, {session});\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.useVersions) {\n\t\t\t\t\ttry {\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\t\t\n\t\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, {upsert: true});\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (doc.__v >= 4) {\n\t\t\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).deleteMany(<any>{$and: [{'_id._id': doc._id}, {'_id.__v': {$lt: doc.__v - 4}}]});\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcatch {}\n\t\n\t\t\t\t\tif (!update.$inc) {\n\t\t\t\t\t\tupdate.$inc = {};\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif (typeof update.$inc.__v !== 'number') {\n\t\t\t\t\t\tupdate.$inc.__v = 1;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t// If someone mistakenly put __v in $set, remove it\n\t\t\t\t\tif (update.$set && '__v' in update.$set) {\n\t\t\t\t\t\tdelete update.$set.__v;\n\t\t\t\t\t\tif (Object.keys(update.$set).length === 0) {\n\t\t\t\t\t\t\tdelete update.$set;\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(filter, <any>update, options) as UpdateResult;\n\t\t\tif (!this.skipCache) {\n\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t}\n\n\t\t\treturn res;\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(JSON.stringify([new Date(), 'Error Update Many', this.collectionName, filter, update, safeOptions, {\n\t\t\t\tcode: err.code,\n\t\t\t\tcodeName: err.codeName,\n\t\t\t\tmessage: err.message,\n\t\t\t\tstack: err.stack\n\t\t\t}], null, 2));\n\n\t\t\terr.message = `Error in Update Many: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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<UpdateResult> {\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\tawait ResolveIOServer.getMainServer().getMethodManager().callMethod('insertErrorLog', 'Schema Failed on updateOne - ' + this.collectionName, JSON.stringify([validation.validationErrors(), update], null, 2));\n\t\t\t\tthrow new Error(JSON.stringify(validation.validationErrors(), null, 2));\n\t\t\t}\n\t\t}\n\n\t\tconst isEmptyUpdate = !update.$set && !update.$unset && !update.$inc && !update.$setOnInsert && !update.$push && !update.$pull && !update.$addToSet && !update.$min && !update.$max && !update.$currentDate && !update.$mul && !update.$rename;\n\n\t\tconst allEmpty =\n\t\t\tisEmptyUpdate ||\n\t\t\tObject.values(update).every(op => {\n\t\t\t\treturn !op || JSON.stringify(op) === '{}';\n\t\t\t});\n\n\t\tif (allEmpty) {\n\t\t\treturn {\n\t\t\t\tacknowledged: false,\n\t\t\t\tmatchedCount: 0,\n\t\t\t\tmodifiedCount: 0,\n\t\t\t\tupsertedCount: 0,\n\t\t\t\tupsertedId: null\n\t\t\t};\n\t\t}\n\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\n\t\tif (mongoSession && !bypassSession && !this.bypassSession && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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\n\t\tlet { session, ...safeOptions } = options || {};\n\t\t\n\t\tif (this.useVersions) {\n\t\t\tlet doc = await this.findOne(filter, {session}, 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])) < 1000000 ? 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])) < 1000000 ? 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}, {session});\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\ttry {\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\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, {upsert: true});\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}}]});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch {}\n\n\t\t\t\tif (!update.$inc) {\n\t\t\t\t\tupdate.$inc = {};\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (typeof update.$inc.__v !== 'number') {\n\t\t\t\t\tupdate.$inc.__v = 1;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// If someone mistakenly put __v in $set, remove it\n\t\t\t\tif (update.$set && '__v' in update.$set) {\n\t\t\t\t\tdelete update.$set.__v;\n\t\t\t\t\tif (Object.keys(update.$set).length === 0) {\n\t\t\t\t\t\tdelete update.$set;\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 (!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;\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(JSON.stringify([new Date(), 'Error Update One', this.collectionName, filter, update, safeOptions, {\n\t\t\t\t\t\tcode: err.code,\n\t\t\t\t\t\tcodeName: err.codeName,\n\t\t\t\t\t\tmessage: err.message,\n\t\t\t\t\t\tstack: err.stack\n\t\t\t\t\t}], null, 2));\n\t\t\n\t\t\t\t\terr.message = `Error in Update One: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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])) < 1000000 ? 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])) < 1000000 ? 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}, {session});\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 (!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;\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(JSON.stringify([new Date(), 'Error Update One', this.collectionName, filter, safeOptions, {\n\t\t\t\t\t\tcode: err.code,\n\t\t\t\t\t\tcodeName: err.codeName,\n\t\t\t\t\t\tmessage: err.message,\n\t\t\t\t\t\tstack: err.stack\n\t\t\t\t\t}], null, 2));\n\t\t\n\t\t\t\t\terr.message = `Error in Update One: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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\treturn {\n\t\t\t\t\tacknowledged: false,\n\t\t\t\t\tmatchedCount: 0,\n\t\t\t\t\tmodifiedCount: 0,\n\t\t\t\t\tupsertedCount: 0,\n\t\t\t\t\tupsertedId: null\n\t\t\t\t};\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).updateOne(<any>filter, update, options);\n\n\t\t\t\t\tlet doc = await this.findOne(filter, options);\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])) < 1000000 ? 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])) < 1000000 ? 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}, {session});\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn res;\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])) < 1000000 ? 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])) < 1000000 ? 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\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\treturn res;\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(JSON.stringify([new Date(), 'Error Update One (Find One And Update)', this.collectionName, filter, safeOptions, {\n\t\t\t\t\t\tcode: err.code,\n\t\t\t\t\t\tcodeName: err.codeName,\n\t\t\t\t\t\tmessage: err.message,\n\t\t\t\t\t\tstack: err.stack\n\t\t\t\t\t}], null, 2));\n\t\t\n\t\t\t\t\terr.message = `Error in Update One (Find One And Update): ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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 (!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;\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(JSON.stringify([new Date(), 'Error Update One', this.collectionName, filter, update, safeOptions, {\n\t\t\t\t\t\tcode: err.code,\n\t\t\t\t\t\tcodeName: err.codeName,\n\t\t\t\t\t\tmessage: err.message,\n\t\t\t\t\t\tstack: err.stack\n\t\t\t\t\t}], null, 2));\n\t\t\n\t\t\t\t\terr.message = `Error in Update One: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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}"]}
|
|
1
|
+
{"version":3,"sources":["../../src/managers/mongo.manager.ts"],"names":["NodeCache","require","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","code","err_1","codeName","message","stack","concat","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","readPreference","err_5","aggregateCount","err_6","aggregateCursor","cursor","ev","aggregateStream","streamOptions","stream","bulkWrite","operations","bypassCheckSchema","bypassLogs","bypassVersions","BATCH_SIZE","opIndex","batchOps","slice","logs","versionOps","e_4","batchOps_1","batchOps_1_1","op","opType","Object","doc","validationContext","newContext","isValid","validate","document","replacement","modifier","Error","validationErrors","createdAt","updatedAt","objectIdHexString","id_document","payload","method","id_user","user","messageId","route","$set","$inc","__v","affectedDocs","versionFilters","map","v","$or","_f","versionInserts","insertOne","__assign","err_7","getServerConfig","getLocalLogManager","writeLogs","bwOptions","ordered","affectedDocIds","$in","$sort","$group","versions","$push","$project","versionsToDelete","$slice","$size","$unwind","$replaceRoot","newRoot","oldVersions","deleteMany","ok","estimatedDocumentCount","err_8","f_docs","Array","isArray","insertMany","fieldOrSpec","dbCollection","indexes","existingIndexes","index","createIndexes","indexSpecs","existingIndexes_1","indexSpec","existingIndex","docs","i","writeLog","versionDoc","replaceOne","upsert","$lt","res","err_9","deleteOne","err_10","err_11","distinct","err_12","drop","err_13","dropIndex","indexName","err_14","dropIndexes","err_15","err_16","findById","id","err_17","findCount","count","err_18","findCursor","removeAllListeners","findStream","err_19","findOneAndDelete","err_20","findOneAndReplace","validation","getMethodManager","callMethod","date","err_21","findOneAndUpdate","$setOnInsert","err_22","err_23","indexExists","err_24","bypassMonitor","validationResults","docs_1","docs_1_1","validDocs","idx","hasOwnProperty","err_25","err_26","listIndexes","rename","newName","err_27","err_28","prevDoc","docId","docVersion","updatedDoc","getMongoMergeUpdatedDoc","acknowledged","err_29","err_30","matchedCount","modifiedCount","upsertedCount","upsertedId","returnDocument","session_1","safeOptions_1","doc_1","err_31","err_32","updateMany","isEmptyUpdate","$unset","$pull","$addToSet","$min","$max","$currentDate","$mul","$rename","values","every","err_33","updateOne","err_34","err_35","err_36","err_37","watchCollection","_super","__extends","authenticate","password","attemptsInterval","Math","pow","attempts","calculatedInterval","last","now","getTime","Users","error","salt","pbkdf2Promisified","iterations","keylen","digestAlgorithm","hashBuffer","Buffer","hash","err_38","serializeUser","cb","username","deserializeUser","setPassword","randomBytes","saltBuffer","toString","hashRaw","services","err_39","changePassword","oldPassword","newPassword","authUser","register","email","resetAttempts","pbkdf2","callback","reject","err","saltlen"],"mappings":"02GACAA,W,+KAAAC,QAAA,YAAA,GACAC,KAAAD,QAAA,IAAA,EACAE,eAAAF,QAAA,cAAA,EACAG,kBAAAH,QAAA,gCAAA,EAIAI,uBAAAJ,QAAA,yBAAA,EACAK,SAAAL,QAAA,gBAAA,EACAM,kBAAAN,QAAA,mBAAA,EACMO,OAASP,QAAQ,QAAQ,EACzBQ,KAAOR,QAAQ,MAAM,EACrBS,SAAU,EAAAR,KAAAS,MAAI,EAAGC,OACj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Osc,OAAOtC,EAAUW,EAAMhW,EAAQkW,WAAYlW,EAAQmW,OAAQnW,EAAQoW,gBAAiBwB,CAAQ,CACpG,CAEA,SAAS3B,kBAAkBZ,EAAUW,EAAMhW,GAE1C,OAAO,IAAIJ,QAAQ,SAACC,EAASgY,GAAW,OAAAF,OAAOtC,EAAUW,EAAMhW,EAAS,SAAC8X,EAAKb,GAAY,OAACa,EAAMD,EAAOC,CAAG,EAAIjY,EAAQoX,CAAO,CAApC,CAAsC,CAAxF,CAAyF,CAClI,CAEA,SAASH,YAAYiB,GAEpB,OAAO,IAAInY,QAAQ,SAACC,EAASgY,GAAW,OAAAxc,OAAOyb,YAAYiB,EAAS,SAACD,EAAKf,GAAe,OAACe,EAAMD,EAAOC,CAAG,EAAIjY,EAAQkX,CAAU,CAAvC,CAAyC,CAA1F,CAA2F,CACpI,CApLa1Q,QAAAK,2BAAAA","file":"mongo.manager.js","sourcesContent":["import { AggregateOptions, AggregationCursor, BulkWriteOptions, BulkWriteResult, ChangeStream, ChangeStreamOptions, Collection, CollectionInfo, CommandOperationOptions, CountDocumentsOptions, CreateCollectionOptions, CreateIndexesOptions, CursorStreamOptions, DeleteOptions, DeleteResult, FindCursor, FindOneAndDeleteOptions, FindOneAndReplaceOptions, FindOneAndUpdateOptions, FindOptions, IndexDescription, IndexInformationOptions, InsertOneOptions, ListIndexesCursor, ListIndexesOptions, OptionalUnlessRequiredId, RenameOptions, ReplaceOptions, UpdateOptions, UpdateResult } 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 MongoManagerRenameFilter<T> = {\n\t// eslint-disable-next-line no-unused-vars\n\t[P in keyof T]?: string;\n};\n\nexport declare type MongoManagerArrayFilter<T> = {\n\t// eslint-disable-next-line no-unused-vars\n\t[P in keyof T]?: any; // can refine if needed\n};\n\nexport declare type MongoManagerCurrentDateFilter<T> = {\n\t// eslint-disable-next-line no-unused-vars\n\t[P in keyof T]?: true | { $type: 'date' | 'timestamp' };\n};\n\nexport declare type MongoManagerUpdateFilter<T> = {\n\t$set?: MongoManagerFilter<T> | Document;\n\t$unset?: MongoManagerUnsetFilter<T> | Document;\n\t$inc?: MongoManagerIncFilter<T> | Document;\n\t$setOnInsert?: MongoManagerFilter<T> | Document;\n\t$push?: MongoManagerArrayFilter<T> | Document;\n\t$pull?: MongoManagerArrayFilter<T> | Document;\n\t$addToSet?: MongoManagerArrayFilter<T> | Document;\n\t$min?: MongoManagerIncFilter<T> | Document;\n\t$max?: MongoManagerIncFilter<T> | Document;\n\t$currentDate?: MongoManagerCurrentDateFilter<T> | Document;\n\t$mul?: MongoManagerIncFilter<T> | Document;\n\t$rename?: MongoManagerRenameFilter<T>;\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\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\tconsole.log(JSON.stringify([new Date(), 'Error Execute Find', collectionName, filter, safeOptions, {\n\t\t\t\tcode: err.code,\n\t\t\t\tcodeName: err.codeName,\n\t\t\t\tmessage: err.message,\n\t\t\t\tstack: err.stack\n\t\t\t}], null, 2));\n\n\t\t\terr.message = `Error in Execute Find: ${collectionName} => ${err.codeName || 'NoCodeName'} => ${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\tconsole.log(JSON.stringify([new Date(), 'Error Execute Find One', collectionName, filter, safeOptions, {\n\t\t\t\tcode: err.code,\n\t\t\t\tcodeName: err.codeName,\n\t\t\t\tmessage: err.message,\n\t\t\t\tstack: err.stack\n\t\t\t}], null, 2));\n\n\t\t\terr.message = `Error in Execute Find One: ${collectionName} => ${err.codeName || 'NoCodeName'} => ${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\tconsole.log(JSON.stringify([new Date(), 'Error Execute Aggregate', collectionName, pipeline, collections, safeOptions, {\n\t\t\t\tcode: err.code,\n\t\t\t\tcodeName: err.codeName,\n\t\t\t\tmessage: err.message,\n\t\t\t\tstack: err.stack\n\t\t\t}], null, 2));\n\n\t\t\terr.message = `Error in Execute Aggregate: ${collectionName} => ${err.codeName || 'NoCodeName'} => ${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\tconsole.log(JSON.stringify([new Date(), 'Error Execute Count Documents', collectionName, filter, safeOptions, {\n\t\t\t\tcode: err.code,\n\t\t\t\tcodeName: err.codeName,\n\t\t\t\tmessage: err.message,\n\t\t\t\tstack: err.stack\n\t\t\t}], null, 2));\n\n\t\t\terr.message = `Error in Execute Count Documents: ${collectionName} => ${err.codeName || 'NoCodeName'} => ${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} \n\t\tcatch {\n\t\t\tthis._nodeCache.del(cacheKey);\n\t\t}\n\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\tsearchFields?: string[];\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\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 && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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(JSON.stringify([new Date(), 'Error Aggregate', this.collectionName, pipeline, safeOptions, {\n\t\t\t\t\tcode: err.code,\n\t\t\t\t\tcodeName: err.codeName,\n\t\t\t\t\tmessage: err.message,\n\t\t\t\t\tstack: err.stack\n\t\t\t\t}], null, 2));\n\t\n\t\t\t\terr.message = `Error in Aggregate: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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 && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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(JSON.stringify([new Date(), 'Error Aggregate Count', this.collectionName, pipeline, safeOptions, {\n\t\t\t\tcode: err.code,\n\t\t\t\tcodeName: err.codeName,\n\t\t\t\tmessage: err.message,\n\t\t\t\tstack: err.stack\n\t\t\t}], null, 2));\n\n\t\t\terr.message = `Error in Aggregate Count: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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 && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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 && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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\n\t\tlet { session, ...safeOptions } = options || {};\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(), null, 2)}`\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\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.document._id || objectIdHexString(),\n\t\t\t\t\t\t\tpayload:\n\t\t\t\t\t\t\t\tgetBinarySize(JSON.stringify(doc.document)) < 1000000\n\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: 'Too Big',\n\t\t\t\t\t\t\tmethod: 'insertOne',\n\t\t\t\t\t\t\tid_user: '', // Add user info if available\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\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\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.filter._id || null,\n\t\t\t\t\t\t\tpayload:\n\t\t\t\t\t\t\t\tgetBinarySize(JSON.stringify(doc.update)) < 1000000\n\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: 'Too Big',\n\t\t\t\t\t\t\tmethod: opType,\n\t\t\t\t\t\t\tid_user: '', // Add user info if available\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\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\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.filter._id || null,\n\t\t\t\t\t\t\tpayload:\n\t\t\t\t\t\t\t\tgetBinarySize(JSON.stringify(doc.replacement)) < 1000000\n\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: 'Too Big',\n\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\tid_user: '', // Add user info if available\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\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\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.filter._id || null,\n\t\t\t\t\t\t\tpayload:\n\t\t\t\t\t\t\t\tgetBinarySize(JSON.stringify(doc.filter)) < 1000000\n\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: 'Too Big',\n\t\t\t\t\t\t\tmethod: opType,\n\t\t\t\t\t\t\tid_user: '', // Add user info if available\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\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\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\n\t\t\t\t\tif (versionFilters.length) {\n\t\t\t\t\t\taffectedDocs = await ResolveIOServer.getMainDB().collection(this.collectionName).find({ $or: versionFilters }, {session}).toArray();\n\t\t\t\t\t}\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\ttry {\n\t\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection(this.versionCollection).bulkWrite(<any>versionInserts);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch {}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch {}\n\t\t\t}\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\tconsole.log(JSON.stringify([new Date(), 'Error Bulk Write', this.collectionName, operations, safeOptions, {\n\t\t\t\t\tcode: err.code,\n\t\t\t\t\tcodeName: err.codeName,\n\t\t\t\t\tmessage: err.message,\n\t\t\t\t\tstack: err.stack\n\t\t\t\t}], null, 2));\n\t\n\t\t\t\terr.message = `Error in Bulk Write: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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\tbwOptions = {session, ordered: false};\n\n\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').bulkWrite(logs.map(a => {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tinsertOne: {\n\t\t\t\t\t\t\t\tdocument: a\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\t\t\t\t\t}), bwOptions);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!bypassVersions && this.useVersions) {\n\t\t\t\ttry {\n\t\t\t\t\t// Delete old versions beyond the latest 5\n\t\t\t\t\tconst affectedDocIds = affectedDocs.map((doc) => doc._id);\n\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\t\t\t\n\t\t\t\t\tconst oldVersions = await ResolveIOServer.getMainDB().collection(this.versionCollection).aggregate(pipeline).toArray();\n\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) } });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch {}\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): Promise<number> {\n\t\t\n\t\t// ********* COUNTS ARE NOT SUPPORTED IN MONGO SESSIONS! ***************\n\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(safeOptions);\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, safeOptions);\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, safeOptions);\n\t\t\t\treturn res;\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tconsole.log(JSON.stringify([new Date(), 'Error Count Documents', this.collectionName, filter, safeOptions, {\n\t\t\t\t\tcode: err.code,\n\t\t\t\t\tcodeName: err.codeName,\n\t\t\t\t\tmessage: err.message,\n\t\t\t\t\tstack: err.stack\n\t\t\t\t}], null, 2));\n\t\n\t\t\t\terr.message = `Error in Count Documents: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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\t// Check if index already exists based on the key\n\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// 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\treturn dbCollection.createIndex(fieldOrSpec, options);\n\t\t}\n\t\tcatch {}\n\t\t\n\t\treturn 'Index creation queued';\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\treturn dbCollection.createIndexes(indexSpecs, options);\n\t\t}\n\t\tcatch {}\n\n\t\treturn ['Index creation queued'];\n\t}\n\t\n\tasync deleteMany(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {}, options?: DeleteOptions, bypassLogs = false, bypassSession = false): Promise<DeleteResult> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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\tlet { session, ...safeOptions } = options || {};\n\n\t\tif ((this.createLogs && !bypassLogs) || this.useVersions) {\n\t\t\tlet docs = await this.find(filter, {session});\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])) < 1000000 ? 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])) < 1000000 ? 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}, {session});\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.useVersions) {\n\t\t\t\t\ttry {\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\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, {upsert: true});\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}}]});\n\t\t\t\t\t}\n\t\t\t\t\tcatch {}\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 (!this.skipCache) {\n\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t}\n\n\t\t\treturn res;\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(JSON.stringify([new Date(), 'Error Delete Many', this.collectionName, filter, safeOptions, {\n\t\t\t\tcode: err.code,\n\t\t\t\tcodeName: err.codeName,\n\t\t\t\tmessage: err.message,\n\t\t\t\tstack: err.stack\n\t\t\t}], null, 2));\n\n\t\t\terr.message = `Error in Delete Many: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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<DeleteResult> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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\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 res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).deleteOne(<any>filter, options);\n\t\t\t\tlet doc = await this.findOne(filter, options);\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])) < 1000000 ? 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])) < 1000000 ? 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}, {session});\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\ttry {\n\t\t\t\t\t\t\tlet versionDoc = deepCopy(doc);\n\t\t\t\t\t\t\tversionDoc._id = {_id: doc._id, __v: doc.__v};\n\n\t\t\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, {upsert: true});\n\t\t\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).deleteMany(<any>{$and: [{'_id._id': doc._id}, {'_id.__v': {$lt: doc.__v - 1}}]});\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch {}\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\t\t\t\t}\n\n\t\t\t\treturn res;\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tconsole.log(JSON.stringify([new Date(), 'Error Delete One (Find One And Delete)', this.collectionName, filter, safeOptions, {\n\t\t\t\t\tcode: err.code,\n\t\t\t\t\tcodeName: err.codeName,\n\t\t\t\t\tmessage: err.message,\n\t\t\t\t\tstack: err.stack\n\t\t\t\t}], null, 2));\n\t\n\t\t\t\terr.message = `Error in Delete One (Find One And Delete): ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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 (!this.skipCache) {\n\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t}\n\t\t\t\treturn res;\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tconsole.log(JSON.stringify([new Date(), 'Error Delete One', this.collectionName, filter, safeOptions, {\n\t\t\t\t\tcode: err.code,\n\t\t\t\t\tcodeName: err.codeName,\n\t\t\t\t\tmessage: err.message,\n\t\t\t\t\tstack: err.stack\n\t\t\t\t}], null, 2));\n\t\n\t\t\t\terr.message = `Error in Delete One: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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 && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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(JSON.stringify([new Date(), 'Error Distinct', this.collectionName, filter, safeOptions, {\n\t\t\t\tcode: err.code,\n\t\t\t\tcodeName: err.codeName,\n\t\t\t\tmessage: err.message,\n\t\t\t\tstack: err.stack\n\t\t\t}], null, 2));\n\n\t\t\terr.message = `Error in Distinct: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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 && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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(JSON.stringify([new Date(), 'Error Drop Collection', this.collectionName, safeOptions, {\n\t\t\t\tcode: err.code,\n\t\t\t\tcodeName: err.codeName,\n\t\t\t\tmessage: err.message,\n\t\t\t\tstack: err.stack\n\t\t\t}], null, 2));\n\n\t\t\terr.message = `Error in Drop Collection: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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 && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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(JSON.stringify([new Date(), 'Error Drop Index', this.collectionName, indexName, safeOptions, {\n\t\t\t\tcode: err.code,\n\t\t\t\tcodeName: err.codeName,\n\t\t\t\tmessage: err.message,\n\t\t\t\tstack: err.stack\n\t\t\t}], null, 2));\n\n\t\t\terr.message = `Error in Drop Index: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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 && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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(JSON.stringify([new Date(), 'Error Drop Indexes', this.collectionName, safeOptions, {\n\t\t\t\tcode: err.code,\n\t\t\t\tcodeName: err.codeName,\n\t\t\t\tmessage: err.message,\n\t\t\t\tstack: err.stack\n\t\t\t}], null, 2));\n\n\t\t\terr.message = `Error in Drop Indexes: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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 && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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\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(JSON.stringify([new Date(), 'Error Find', this.collectionName, filter, safeOptions, {\n\t\t\t\t\tcode: err.code,\n\t\t\t\t\tcodeName: err.codeName,\n\t\t\t\t\tmessage: err.message,\n\t\t\t\t\tstack: err.stack\n\t\t\t\t}], null, 2));\n\t\n\t\t\t\terr.message = `Error in Find: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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 && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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(JSON.stringify([new Date(), 'Error Find By ID', this.collectionName, id, safeOptions, {\n\t\t\t\t\tcode: err.code,\n\t\t\t\t\tcodeName: err.codeName,\n\t\t\t\t\tmessage: err.message,\n\t\t\t\t\tstack: err.stack\n\t\t\t\t}], null, 2));\n\t\n\t\t\t\terr.message = `Error in Find By ID: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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 && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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(JSON.stringify([new Date(), 'Error Find Count', this.collectionName, filter, safeOptions, {\n\t\t\t\tcode: err.code,\n\t\t\t\tcodeName: err.codeName,\n\t\t\t\tmessage: err.message,\n\t\t\t\tstack: err.stack\n\t\t\t}], null, 2));\n\n\t\t\terr.message = `Error in Find Count: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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 && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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 && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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 && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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(JSON.stringify([new Date(), 'Error Find One', this.collectionName, filter, safeOptions, {\n\t\t\t\t\tcode: err.code,\n\t\t\t\t\tcodeName: err.codeName,\n\t\t\t\t\tmessage: err.message,\n\t\t\t\t\tstack: err.stack\n\t\t\t\t}], null, 2));\n\t\n\t\t\t\terr.message = `Error in Find One: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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\tif (mongoSession && !bypassSession && !this.bypassSession && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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\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])) < 1000000 ? 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])) < 1000000 ? 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}, {session});\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.useVersions) {\n\t\t\t\t\ttry {\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\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, {upsert: true});\n\t\t\t\t\t}\n\t\t\t\t\tcatch {}\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(JSON.stringify([new Date(), 'Error Find One And Delete', this.collectionName, filter, safeOptions, {\n\t\t\t\tcode: err.code,\n\t\t\t\tcodeName: err.codeName,\n\t\t\t\tmessage: err.message,\n\t\t\t\tstack: err.stack\n\t\t\t}], null, 2));\n\n\t\t\terr.message = `Error in Find One And Delete: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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\tawait ResolveIOServer.getMainServer().getMethodManager().callMethod('insertErrorLog', 'Schema Failed on findOneAndReplace - ' + this.collectionName, JSON.stringify([validation.validationErrors(), replacement], null, 2));\n\t\t\t\tthrow new Error(JSON.stringify(validation.validationErrors(), null, 2));\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\tif (mongoSession && !bypassSession && !this.bypassSession && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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\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])) < 1000000 ? 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])) < 1000000 ? 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}, {session});\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.useVersions) {\n\t\t\t\t\ttry {\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\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, {upsert: true});\n\t\t\t\t\t}\n\t\t\t\t\tcatch {}\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(JSON.stringify([new Date(), 'Error Find One And Replace', this.collectionName, filter, safeOptions, {\n\t\t\t\tcode: err.code,\n\t\t\t\tcodeName: err.codeName,\n\t\t\t\tmessage: err.message,\n\t\t\t\tstack: err.stack\n\t\t\t}], null, 2));\n\n\t\t\terr.message = `Error in Find One And Replace: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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\tawait ResolveIOServer.getMainServer().getMethodManager().callMethod('insertErrorLog', 'Schema Failed on findOneAndUpdate - ' + this.collectionName, JSON.stringify([validation.validationErrors(), update], null, 2));\n\t\t\t\tthrow new Error(JSON.stringify(validation.validationErrors(), null, 2));\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\tif (mongoSession && !bypassSession && !this.bypassSession && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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\n\t\t \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])) < 1000000 ? 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])) < 1000000 ? 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}, {session});\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.useVersions) {\n\t\t\t\t\ttry {\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\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, {upsert: true});\n\t\t\t\t\t}\n\t\t\t\t\tcatch {}\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(JSON.stringify([new Date(), 'Error Find One And Update', this.collectionName, filter, safeOptions, {\n\t\t\t\tcode: err.code,\n\t\t\t\tcodeName: err.codeName,\n\t\t\t\tmessage: err.message,\n\t\t\t\tstack: err.stack\n\t\t\t}], null, 2));\n\n\t\t\terr.message = `Error in Find One And Update: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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): Promise<any[]> {\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(JSON.stringify([new Date(), 'Error Indexes', this.collectionName, safeOptions, {\n\t\t\t\tcode: err.code,\n\t\t\t\tcodeName: err.codeName,\n\t\t\t\tmessage: err.message,\n\t\t\t\tstack: err.stack\n\t\t\t}], null, 2));\n\n\t\t\terr.message = `Error in Indexes: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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): Promise<boolean> {\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(JSON.stringify([new Date(), 'Error Index Exists', this.collectionName, indexes, safeOptions, {\n\t\t\t\tcode: err.code,\n\t\t\t\tcodeName: err.codeName,\n\t\t\t\tmessage: err.message,\n\t\t\t\tstack: err.stack\n\t\t\t}], null, 2));\n\n\t\t\terr.message = `Error in Index Exists: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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\tfor (let doc of docs) {\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\tawait ResolveIOServer.getMainServer().getMethodManager().callMethod('insertErrorLog', 'Schema Failed on insertMany - ' + this.collectionName, JSON.stringify([validation.validationErrors(), doc], null, 2));\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\tif (mongoSession && !bypassSession && !this.bypassSession && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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\n\t\t \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])) < 1000000 ? 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])) < 1000000 ? 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}, {session});\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\tawait ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).insertMany(<OptionalUnlessRequiredId<T>[]>validDocs, options);\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 validDocs;\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tconsole.log(JSON.stringify([new Date(), 'Error Insert Many', this.collectionName, docs, safeOptions, {\n\t\t\t\t\tcode: err.code,\n\t\t\t\t\tcodeName: err.codeName,\n\t\t\t\t\tmessage: err.message,\n\t\t\t\t\tstack: err.stack\n\t\t\t\t}], null, 2));\n\t\n\t\t\t\terr.message = `Error in Insert Many: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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\tawait ResolveIOServer.getMainServer().getMethodManager().callMethod('insertErrorLog', 'Schema Failed on insertOne - ' + this.collectionName, JSON.stringify([validation.validationErrors(), doc], null, 2));\n\t\t\t\tthrow new Error(JSON.stringify(validation.validationErrors(), null, 2));\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\tif (mongoSession && !bypassSession && !this.bypassSession && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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\n\t\t \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])) < 1000000 ? 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])) < 1000000 ? 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}, {session});\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\tawait ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).insertOne(<OptionalUnlessRequiredId<T>>doc, options);\n\t\t\tif (!this.skipCache) {\n\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t}\n\t\t\t\n\t\t\treturn doc;\n\t\t}\n\t\tcatch(err) {\n\t\t\tconsole.log(JSON.stringify([new Date(), 'Error Insert One', this.collectionName, doc, safeOptions, {\n\t\t\t\tcode: err.code,\n\t\t\t\tcodeName: err.codeName,\n\t\t\t\tmessage: err.message,\n\t\t\t\tstack: err.stack\n\t\t\t}], null, 2));\n\n\t\t\terr.message = `Error in Insert One: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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 && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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 && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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(JSON.stringify([new Date(), 'Error Rename', this.collectionName, newName, safeOptions, {\n\t\t\t\tcode: err.code,\n\t\t\t\tcodeName: err.codeName,\n\t\t\t\tmessage: err.message,\n\t\t\t\tstack: err.stack\n\t\t\t}], null, 2));\n\n\t\t\terr.message = `Error in Rename: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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<UpdateResult> {\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\tawait ResolveIOServer.getMainServer().getMethodManager().callMethod('insertErrorLog', 'Schema Failed on replaceOne - ' + this.collectionName, JSON.stringify([validation.validationErrors(), replacement], null, 2));\n\t\t\t\tthrow new Error(JSON.stringify(validation.validationErrors(), null, 2));\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\tif (mongoSession && !bypassSession && !this.bypassSession && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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\n\t\t \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, {session}, 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\ttry {\n\t\t\t\t\t\treplacement.__v += 1;\n\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\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, {upsert: true});\n\n\t\t\t\t\t\tif (doc.__v >= 4) {\n\t\t\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).deleteMany(<any>{$and: [{'_id._id': doc._id}, {'_id.__v': {$lt: doc.__v - 4}}]});\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcatch {}\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])) < 1000000 ? 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])) < 1000000 ? 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}, {session});\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) as UpdateResult;\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;\n\t\t\t\t\t}\n\t\t\t\t\tcatch (err) {\n\t\t\t\t\t\tconsole.log(JSON.stringify([new Date(), 'Error Replace One', this.collectionName, filter, replacement, safeOptions, {\n\t\t\t\t\t\t\tcode: err.code,\n\t\t\t\t\t\t\tcodeName: err.codeName,\n\t\t\t\t\t\t\tmessage: err.message,\n\t\t\t\t\t\t\tstack: err.stack\n\t\t\t\t\t\t}], null, 2));\n\t\t\t\n\t\t\t\t\t\terr.message = `Error in Replace One: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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])) < 1000000 ? 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])) < 1000000 ? 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}, {session});\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 (!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.acknowledged;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch (err) {\n\t\t\t\t\t\t\tconsole.log(JSON.stringify([new Date(), 'Error Replace One', this.collectionName, filter, replacement, safeOptions, {\n\t\t\t\t\t\t\t\tcode: err.code,\n\t\t\t\t\t\t\t\tcodeName: err.codeName,\n\t\t\t\t\t\t\t\tmessage: err.message,\n\t\t\t\t\t\t\t\tstack: err.stack\n\t\t\t\t\t\t\t}], null, 2));\n\t\t\t\t\n\t\t\t\t\t\t\terr.message = `Error in Replace One: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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 Replace 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])) < 1000000 ? 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])) < 1000000 ? 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}, {session});\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 (!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.acknowledged;\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(JSON.stringify([new Date(), 'Error Replace One', this.collectionName, filter, replacement, safeOptions, {\n\t\t\t\t\t\tcode: err.code,\n\t\t\t\t\t\tcodeName: err.codeName,\n\t\t\t\t\t\tmessage: err.message,\n\t\t\t\t\t\tstack: err.stack\n\t\t\t\t\t}], null, 2));\n\t\t\n\t\t\t\t\terr.message = `Error in Replace One: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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\treturn {\n\t\t\t\t\tacknowledged: false,\n\t\t\t\t\tmatchedCount: 0,\n\t\t\t\t\tmodifiedCount: 0,\n\t\t\t\t\tupsertedCount: 0,\n\t\t\t\t\tupsertedId: null\n\t\t\t\t};\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 \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).replaceOne(<any>filter, replacement, options) as UpdateResult;\n\n\t\t\t\t\tlet doc = await this.findOne(filter, options);\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])) < 1000000 ? 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])) < 1000000 ? 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}, {session});\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])) < 1000000 ? 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])) < 1000000 ? 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}, {session});\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 res;\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(JSON.stringify([new Date(), 'Error Replace One (Find One And Replace)', this.collectionName, filter, safeOptions, {\n\t\t\t\t\t\tcode: err.code,\n\t\t\t\t\t\tcodeName: err.codeName,\n\t\t\t\t\t\tmessage: err.message,\n\t\t\t\t\t\tstack: err.stack\n\t\t\t\t\t}], null, 2));\n\t\t\n\t\t\t\t\terr.message = `Error in Replace One (Find One And Replace): ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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 (!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.acknowledged;\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(JSON.stringify([new Date(), 'Error Replace One', this.collectionName, filter, replacement, safeOptions, {\n\t\t\t\t\t\tcode: err.code,\n\t\t\t\t\t\tcodeName: err.codeName,\n\t\t\t\t\t\tmessage: err.message,\n\t\t\t\t\t\tstack: err.stack\n\t\t\t\t\t}], null, 2));\n\t\t\n\t\t\t\t\terr.message = `Error in Replace One: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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<UpdateResult> {\n\t\tconst isEmptyUpdate = !update.$set && !update.$unset && !update.$inc && !update.$setOnInsert && !update.$push && !update.$pull && !update.$addToSet && !update.$min && !update.$max && !update.$currentDate && !update.$mul && !update.$rename;\n\n\t\tconst allEmpty =\n\t\t\tisEmptyUpdate ||\n\t\t\tObject.values(update).every(op => {\n\t\t\t\treturn !op || JSON.stringify(op) === '{}';\n\t\t\t});\n\n\t\tif (allEmpty) {\n\t\t\treturn {\n\t\t\t\tacknowledged: false,\n\t\t\t\tmatchedCount: 0,\n\t\t\t\tmodifiedCount: 0,\n\t\t\t\tupsertedCount: 0,\n\t\t\t\tupsertedId: null\n\t\t\t};\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\tawait ResolveIOServer.getMainServer().getMethodManager().callMethod('insertErrorLog', 'Schema Failed on updateMany - ' + this.collectionName, JSON.stringify([validation.validationErrors(), update], null, 2));\n\t\t\t\tthrow new Error(JSON.stringify(validation.validationErrors(), null, 2));\n\t\t\t}\n\t\t}\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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\n\t\t \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, {session});\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])) < 1000000 ? 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])) < 1000000 ? 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}, {session});\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.useVersions) {\n\t\t\t\t\ttry {\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\t\t\n\t\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, {upsert: true});\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (doc.__v >= 4) {\n\t\t\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).deleteMany(<any>{$and: [{'_id._id': doc._id}, {'_id.__v': {$lt: doc.__v - 4}}]});\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcatch {}\n\t\n\t\t\t\t\tif (!update.$inc) {\n\t\t\t\t\t\tupdate.$inc = {};\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif (typeof update.$inc.__v !== 'number') {\n\t\t\t\t\t\tupdate.$inc.__v = 1;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t// If someone mistakenly put __v in $set, remove it\n\t\t\t\t\tif (update.$set && '__v' in update.$set) {\n\t\t\t\t\t\tdelete update.$set.__v;\n\t\t\t\t\t\tif (Object.keys(update.$set).length === 0) {\n\t\t\t\t\t\t\tdelete update.$set;\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(filter, <any>update, options) as UpdateResult;\n\t\t\tif (!this.skipCache) {\n\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t}\n\n\t\t\treturn res;\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(JSON.stringify([new Date(), 'Error Update Many', this.collectionName, filter, update, safeOptions, {\n\t\t\t\tcode: err.code,\n\t\t\t\tcodeName: err.codeName,\n\t\t\t\tmessage: err.message,\n\t\t\t\tstack: err.stack\n\t\t\t}], null, 2));\n\n\t\t\terr.message = `Error in Update Many: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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<UpdateResult> {\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\tawait ResolveIOServer.getMainServer().getMethodManager().callMethod('insertErrorLog', 'Schema Failed on updateOne - ' + this.collectionName, JSON.stringify([validation.validationErrors(), update], null, 2));\n\t\t\t\tthrow new Error(JSON.stringify(validation.validationErrors(), null, 2));\n\t\t\t}\n\t\t}\n\n\t\tconst isEmptyUpdate = !update.$set && !update.$unset && !update.$inc && !update.$setOnInsert && !update.$push && !update.$pull && !update.$addToSet && !update.$min && !update.$max && !update.$currentDate && !update.$mul && !update.$rename;\n\n\t\tconst allEmpty =\n\t\t\tisEmptyUpdate ||\n\t\t\tObject.values(update).every(op => {\n\t\t\t\treturn !op || JSON.stringify(op) === '{}';\n\t\t\t});\n\n\t\tif (allEmpty) {\n\t\t\treturn {\n\t\t\t\tacknowledged: false,\n\t\t\t\tmatchedCount: 0,\n\t\t\t\tmodifiedCount: 0,\n\t\t\t\tupsertedCount: 0,\n\t\t\t\tupsertedId: null\n\t\t\t};\n\t\t}\n\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\n\t\tif (mongoSession && !bypassSession && !this.bypassSession && (!options || ((!options.readPreference || options.readPreference === 'primary') && !options.session))) {\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\n\t\tlet { session, ...safeOptions } = options || {};\n\t\t\n\t\tif (this.useVersions) {\n\t\t\tlet doc = await this.findOne(filter, {session}, 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])) < 1000000 ? 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])) < 1000000 ? 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}, {session});\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\ttry {\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\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, {upsert: true});\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}}]});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch {}\n\n\t\t\t\tif (!update.$inc) {\n\t\t\t\t\tupdate.$inc = {};\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (typeof update.$inc.__v !== 'number') {\n\t\t\t\t\tupdate.$inc.__v = 1;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// If someone mistakenly put __v in $set, remove it\n\t\t\t\tif (update.$set && '__v' in update.$set) {\n\t\t\t\t\tdelete update.$set.__v;\n\t\t\t\t\tif (Object.keys(update.$set).length === 0) {\n\t\t\t\t\t\tdelete update.$set;\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 (!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;\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(JSON.stringify([new Date(), 'Error Update One', this.collectionName, filter, update, safeOptions, {\n\t\t\t\t\t\tcode: err.code,\n\t\t\t\t\t\tcodeName: err.codeName,\n\t\t\t\t\t\tmessage: err.message,\n\t\t\t\t\t\tstack: err.stack\n\t\t\t\t\t}], null, 2));\n\t\t\n\t\t\t\t\terr.message = `Error in Update One: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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])) < 1000000 ? 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])) < 1000000 ? 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}, {session});\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 (!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;\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(JSON.stringify([new Date(), 'Error Update One', this.collectionName, filter, safeOptions, {\n\t\t\t\t\t\tcode: err.code,\n\t\t\t\t\t\tcodeName: err.codeName,\n\t\t\t\t\t\tmessage: err.message,\n\t\t\t\t\t\tstack: err.stack\n\t\t\t\t\t}], null, 2));\n\t\t\n\t\t\t\t\terr.message = `Error in Update One: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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\treturn {\n\t\t\t\t\tacknowledged: false,\n\t\t\t\t\tmatchedCount: 0,\n\t\t\t\t\tmodifiedCount: 0,\n\t\t\t\t\tupsertedCount: 0,\n\t\t\t\t\tupsertedId: null\n\t\t\t\t};\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).updateOne(<any>filter, update, options);\n\n\t\t\t\t\tlet doc = await this.findOne(filter, options);\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])) < 1000000 ? 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])) < 1000000 ? 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}, {session});\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn res;\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])) < 1000000 ? 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])) < 1000000 ? 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\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\treturn res;\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(JSON.stringify([new Date(), 'Error Update One (Find One And Update)', this.collectionName, filter, safeOptions, {\n\t\t\t\t\t\tcode: err.code,\n\t\t\t\t\t\tcodeName: err.codeName,\n\t\t\t\t\t\tmessage: err.message,\n\t\t\t\t\t\tstack: err.stack\n\t\t\t\t\t}], null, 2));\n\t\t\n\t\t\t\t\terr.message = `Error in Update One (Find One And Update): ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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 (!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;\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(JSON.stringify([new Date(), 'Error Update One', this.collectionName, filter, update, safeOptions, {\n\t\t\t\t\t\tcode: err.code,\n\t\t\t\t\t\tcodeName: err.codeName,\n\t\t\t\t\t\tmessage: err.message,\n\t\t\t\t\t\tstack: err.stack\n\t\t\t\t\t}], null, 2));\n\t\t\n\t\t\t\t\terr.message = `Error in Update One: ${this.collectionName} => ${err.codeName || 'NoCodeName'} => ${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}"]}
|