@resolveio/server-lib 20.7.83 → 20.7.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/managers/mongo.manager.ts"],"names":["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","sessionOptions","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","$lt","res","acknowledged","err_9","deleteOne","findOneAndDelete","returnVal","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","err_20","findOneAndReplace","validation","getMethodManager","callMethod","call","date","upsert","err_21","findOneAndUpdate","$setOnInsert","err_22","err_23","indexExists","err_24","bypassMonitor","validationResults","forEach","validDocs","idx","hasOwnProperty","err_25","err_26","listIndexes","rename","newName","err_27","err_28","prevDoc","docId","docVersion","updatedDoc","getMongoMergeUpdatedDoc","err_29","err_30","returnDocument","safeOptions_1","doc_1","err_31","err_32","updateMany","$unset","objectContainsPropertyDeep","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","obj","prop"],"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,kBAwF9BE,aAAA,WAWC,SAAAA,eAVQC,KAAAC,aAA6D,GAE7DD,KAAAE,UAAsD,GACtDF,KAAAG,qBAA2H,IAAIC,IAC/HJ,KAAAK,UAAYT,GAAGU,kBAAiB,EAAKb,QAErCO,KAAAO,mBAAiF,GACjFP,KAAAQ,kBAAoB,CAAA,EACpBR,KAAAS,kBAAoB,CAAA,CAEb,CAyiBhB,OAviBcV,aAAAW,OAAb,W,gHAEC,MAAA,CAAA,GADMC,EAAe,IAAIZ,cACNa,WAAU,G,OAC7B,OADAC,EAAAC,KAAA,EACA,CAAA,EAAOH,E,OAGMZ,aAAAgB,UAAAH,WAAd,W,gHAWmB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AMD,EAAOC,CAAG,EAAIrX,EAAQsW,CAAU,CAAvC,CAAyC,CAA1F,CAA2F,CACpI,CAEA,SAASrC,2BAA2BsD,EAAaC,GAChD,IAAI9S,EAAOoG,OAAOpG,KAAK6S,CAAG,EAE1B,GAAI7S,EAAKtF,KAAK,SAAAC,GAAK,OAAAA,IAAMmY,CAAN,CAAU,EAC5B,MAAO,CAAA,EAGR,IAAK,IAAIlI,EAAI,EAAGA,EAAI5K,EAAK9I,OAAQ0T,CAAC,GAAI,CACrC,IAAItK,EAAMN,EAAK4K,GACf,GAAIiI,EAAIvS,IAA4B,UAApB,OAAOuS,EAAIvS,IAAqBiP,2BAA2BsD,EAAIvS,GAAMwS,CAAI,EACxF,MAAO,CAAA,C,CAIT,MAAO,CAAA,CACR,CArMahR,QAAAK,2BAAAA","file":"mongo.manager.js","sourcesContent":["import { AggregateOptions, AggregationCursor, BulkWriteOptions, BulkWriteResult, ChangeStream, ChangeStreamOptions, Collection, CollectionInfo, CommandOperationOptions, CountDocumentsOptions, CreateCollectionOptions, CreateIndexesOptions, CursorStreamOptions, DeleteOptions, FindCursor, FindOneAndDeleteOptions, FindOneAndReplaceOptions, FindOneAndUpdateOptions, FindOptions, IndexDescription, IndexInformationOptions, InsertOneOptions, ListIndexesCursor, ListIndexesOptions, OptionalUnlessRequiredId, RenameOptions, ReplaceOptions, UpdateOptions } from 'mongodb';\nimport * as NodeCache from 'node-cache';\nimport { cpus } from 'os';\nimport SimpleSchema from 'simpl-schema';\nimport { Users } from '../collections/user.collection';\nimport { CollectionDocument, Document } from '../models/collection-document.model';\nimport { LookupTables } from '../models/report-builder.model';\nimport { UserModel } from '../models/user.model';\nimport { ResolveIOServer } from '../resolveio-server-app';\nimport { buildRbLookups, buildRbSchema, dateReviver, deepCopy, getBinarySize, getMongoMergeUpdatedDoc, objectIdHexString } from '../util/common';\nimport { MonitorMongo } from './monitor.manager';\nconst crypto = require('crypto');\nconst scmp = require('scmp');\nconst numCPUs = cpus().length;\nconst v8 = require('v8');\nconst { AsyncLocalStorage } = require('async_hooks');\nconst asyncLocalStorage = new AsyncLocalStorage();\n\n// export declare interface MongoManagerFilterOperators<T> extends Document {\nexport declare interface MongoManagerFilterParamaterOperators<P> {\n\t$eq?: P;\n\t$gt?: P;\n\t$gte?: P;\n\t$in?: P extends Array<any> ? P : P[];\n\t$lt?: P;\n\t$lte?: P;\n\t$ne?: P;\n\t$nin?: P extends Array<any> ? P : P[];\n\t$not?: P extends string ? MongoManagerFilterParamaterOperators<P> | RegExpConstructor : MongoManagerFilterParamaterOperators<P>;\n\t$exists?: boolean;\n\t$expr?: any[]\n\t$regex?: P extends string ? RegExpConstructor | string : never;\n\t$options?: P extends string ? string : never;\n\t$geoIntersects?: {\n\t\t$geometry: Document;\n\t};\n\t$geoWithin?: Document;\n\t$near?: Document;\n\t$nearSphere?: Document;\n\t$maxDistance?: number;\n\t$all?: any[];\n\t$elemMatch?: Document;\n\t$size?: P extends any[] ? number : never;\n}\n\nexport declare interface MongoManagerFilterOperators<T> extends Document { //TODO: Remove extends document when I get answer on S.O.\n\t$and?: MongoManagerFilter<T>[] | MongoManagerFilterOperators<T>;\n\t$nor?: MongoManagerFilter<T>[] | MongoManagerFilterOperators<T>;\n\t$or?: MongoManagerFilter<T>[] | MongoManagerFilterOperators<T>;\n\t$text?: {\n\t\t$search: string;\n\t\t$language?: string;\n\t\t$caseSensitive?: boolean;\n\t\t$diacriticSensitive?: boolean;\n\t};\n\t// eslint-disable-next-line no-unused-vars\n\t$where?: string | ((this: T) => boolean);\n\t$comment?: string | Document;\n}\n\n// function isDotStringRegExp(obj: Object, dotKey: string): boolean {\n// \tlet keyData = dotKey.split('.');\n// \tlet objData = obj;\n\t\n// \tfor (let i = 0; i < keyData.length; i++) {\n// \t\tlet key = keyData[i];\n// \t\tif (objData.hasOwnProperty(key)) {\n// \t\t\tobjData = objData[key];\n\t\t\t\n// \t\t\tif (i === keyData.length - 1) {\n// \t\t\t\treturn true;\n// \t\t\t}\n// \t\t}\n// \t\telse {\n// \t\t\treturn false;\n// \t\t}\n// \t}\n// }\n\n// export declare type MongoManagerDotStringFilter<T> = {\n// \t[key: string]: (isDotStringRegExp(T, key) ? any : never);\n// };\n\nexport declare type MongoManagerFilter<T> = {\n\t[P in keyof T]?: T[P] | MongoManagerFilterParamaterOperators<T[P]>;\n};\n\nexport declare type MongoManagerUnsetFilter<T> = {\n\t// eslint-disable-next-line no-unused-vars\n\t[P in keyof T]?: number | boolean;\n};\n\nexport declare type MongoManagerIncFilter<T> = {\n\t// eslint-disable-next-line no-unused-vars\n\t[P in keyof T]?: number;\n};\n\nexport declare type MongoManagerUpdateFilter<T> = {\n\t$inc?: MongoManagerIncFilter<T> | Document;\n\t$set?: MongoManagerFilter<T> | Document;\n\t$setOnInsert?: MongoManagerFilter<T> | Document;\n\t$unset?: MongoManagerUnsetFilter<T> | Document;\n};\n\nexport class MongoManager {\n\tprivate _collections: MongoManagerCollection<CollectionDocument>[] = [];\n\tprivate _nodeCache;\n\tprivate _cacheMap: { collections: string[], key: string }[] = [];\n\tprivate _operationInProgress: Map<string, { promise: Promise<any>, invalidatedDuringExecution: boolean, collections: string[] }> = new Map();\n\tprivate _heapSize = v8.getHeapStatistics() / numCPUs;\n\tprivate _heapLimit: number;\n\tprivate _serverCollections: (CollectionInfo | Pick<CollectionInfo, 'name' | 'type'>)[] = [];\n\tprivate _isWorkersEnabled = false;\n\tprivate _isWorkerInstance = false;\n\n\tconstructor() {}\n\n\tstatic async create() {\n\t\tconst mongoManager = new MongoManager();\n\t\tawait mongoManager.initialize();\n\t\treturn mongoManager;\n\t}\n\n\tprivate async initialize() {\n\t\tthis._nodeCache = new NodeCache({ stdTTL: 0, checkperiod: 0 });\n\n\t\tthis._isWorkersEnabled = process.env.IS_WORKERS_ENABLED === 'true';\n\t\tthis._isWorkerInstance = process.env.IS_WORKER_INSTANCE === 'true';\n\t\tthis.setCacheLimit();\n\n\t\tif (this._isWorkersEnabled && this._isWorkerInstance) {\n\t\t\tthis.setupChangeStream();\n\t\t}\n\n\t\tlet collections = await ResolveIOServer.getMainDB().listCollections().toArray();\n\t\tthis._serverCollections = collections;\n\t}\n\n\toneTimeTransaction<T>(fn: () => Promise<T>): Promise<T> {\n\t\treturn asyncLocalStorage.run({}, async () => {\n\t\t\tconst session = ResolveIOServer.getMongoConnection().startSession();\n\t\t\tasyncLocalStorage.getStore().session = session;\n\t\n\t\t\ttry {\n\t\t\t\tlet result: T;\n\t\t\t\t\n\t\t\t\tawait session.withTransaction(async () => {\n\t\t\t\t\t// Directly assign the result from fn()\n\t\t\t\t\tresult = await fn();\n\t\t\t\t\treturn result; // Explicit return for transaction validation\n\t\t\t\t});\n\t\n\t\t\t\treturn result; // Transaction committed successfully\n\t\t\t} \n\t\t\tfinally {\n\t\t\t\tawait session.endSession();\n\t\t\t\tconst store = asyncLocalStorage.getStore();\n\t\t\t\tif (store) delete store.session;\n\t\t\t}\n\t\t});\n\t}\n\t\n\tgetSession() {\n\t\tconst store = asyncLocalStorage.getStore();\n\t\treturn store ? store.session : null;\n\t}\n\n\tprivate setCacheLimit() {\n\t\tif (this._isWorkersEnabled) {\n\t\t\tthis._heapLimit = this._isWorkerInstance ? this._heapSize * 0.8 : this._heapSize * 0.4;\n\t\t}\n\t\telse {\n\t\t\tthis._heapLimit = this._heapSize * 0.3;\n\t\t}\n\t}\n\n\tgetServerCollections() {\n\t\treturn this._serverCollections;\n\t}\n\n\tasync registerCollection(collection: MongoManagerCollection<CollectionDocument>) {\n\t\tif (\n\t\t\tcollection.collectionOptions &&\n\t\t\tcollection.collectionOptions.timeseries &&\n\t\t\tcollection.collectionOptions.timeseries.timeField &&\n\t\t\tthis._serverCollections.some(a => a.name === collection.collectionName && a.type === 'collection')\n\t\t) {\n\t\t\tawait ResolveIOServer.getMainDB().dropCollection(collection.collectionName);\n\t\t\tawait this.createCollection(collection);\n\t\t}\n\n\t\tthis._collections.push(collection);\n\t}\n\n\tasync createCollection(collection: MongoManagerCollection<CollectionDocument>) {\n\t\tawait ResolveIOServer.getMainDB().createCollection(collection.collectionName, collection.collectionOptions);\n\t}\n\n\tcollections() {\n\t\treturn this._collections;\n\t}\n\n\tcollection(collectionName: string): MongoManagerCollection<CollectionDocument> | MongoManagerUserCollection<CollectionDocument> {\n\t\treturn this._collections.find(a => a.collectionName === collectionName);\n\t}\n\n\tprivate async delay(ms: number) {\n\t\t// eslint-disable-next-line no-restricted-syntax\n\t\treturn new Promise(resolve => setTimeout(resolve, ms));\n\t}\n\n\tpublic async find<T extends CollectionDocument>(\n\t\tcollectionName: string,\n\t\tfilter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {},\n\t\toptions?: FindOptions<T>\n\t): Promise<T[]> {\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\t\tconst cacheKey = this.generateCacheKey([collectionName], 'find', [filter, safeOptions]);\n\t\tlet result = this.getFromCache(cacheKey);\n\t\tif (result !== undefined) {\n\t\t\tif (ResolveIOServer.getMainServer().getSubscriptionManager() && ResolveIOServer.getMainServer().getSubscriptionManager().getEnableDebug()) {\n\t\t\t\tconsole.log(new Date(), 'Mongo Find - Cache', collectionName);\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\tif (this._operationInProgress.has(cacheKey)) {\n\t\t\tif (ResolveIOServer.getMainServer().getSubscriptionManager() && ResolveIOServer.getMainServer().getSubscriptionManager().getEnableDebug()) {\n\t\t\t\tconsole.log(new Date(), 'Mongo Find - Already running', collectionName);\n\t\t\t}\n\t\t\treturn this._operationInProgress.get(cacheKey).promise;\n\t\t}\n\n\t\tif (ResolveIOServer.getMainServer().getSubscriptionManager() && ResolveIOServer.getMainServer().getSubscriptionManager().getEnableDebug()) {\n\t\t\tconsole.log(new Date(), 'Mongo Find - Running', collectionName);\n\t\t}\n\n\t\tconst operation = this.executeFind<T>(collectionName, filter, options, cacheKey);\n\t\tthis._operationInProgress.set(cacheKey, { \n\t\t\tpromise: operation, \n\t\t\tinvalidatedDuringExecution: false,\n\t\t\tcollections: [collectionName]\n\t\t});\n\n\t\tawait operation.finally(() => {\n\t\t\tif (ResolveIOServer.getMainServer().getSubscriptionManager() && ResolveIOServer.getMainServer().getSubscriptionManager().getEnableDebug()) {\n\t\t\t\tconsole.log(new Date(), 'Mongo Find - Done', collectionName);\n\t\t\t}\n\n\t\t\tthis._operationInProgress.delete(cacheKey);\n\t\t});\n\n\t\treturn operation;\n\t}\n\n\tprivate async executeFind<T extends CollectionDocument>(\n\t\tcollectionName: string,\n\t\tfilter: MongoManagerFilter<T> & MongoManagerFilterOperators<T>,\n\t\toptions: FindOptions<T> | undefined,\n\t\tcacheKey: string\n\t): Promise<T[]> {\n\t\tlet result;\n\t\tconst collection = ResolveIOServer.getMainDB().collection(collectionName);\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\t\tconst monitor = MonitorMongo.create('find', collectionName, JSON.stringify([filter, safeOptions]));\n\n\t\ttry {\n\t\t\tresult = await collection.find<T>(<any>filter, options).toArray();\n\t\t}\n\t\tcatch (err) {\n\t\t\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\tlet sessionOptions = null;\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\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\t\n\t\twhile (opIndex < operations.length) {\n\t\t\tconst batchOps = operations.slice(opIndex, opIndex + BATCH_SIZE);\n\t\n\t\t\t// Initialize arrays for logs and version operations\n\t\t\tconst logs = [];\n\t\t\tconst versionOps = [];\n\t\n\t\t\tfor (const op of batchOps) {\n\t\t\t\tconst opType = Object.keys(op)[0];\n\t\t\t\tconst doc = op[opType];\n\t\n\t\t\t\t// Skip validation if bypassCheckSchema is true\n\t\t\t\tif (this.checkSchema && !bypassCheckSchema) {\n\t\t\t\t\tconst validationContext = this.simplschema.newContext();\n\t\t\t\t\tlet isValid: boolean;\n\t\n\t\t\t\t\tif (opType === 'insertOne') {\n\t\t\t\t\t\tisValid = validationContext.validate(doc.document);\n\t\t\t\t\t}\n\t\t\t\t\telse if (opType === 'replaceOne') {\n\t\t\t\t\t\tisValid = validationContext.validate(doc.replacement);\n\t\t\t\t\t}\n\t\t\t\t\telse if (opType === 'updateOne' || opType === 'updateMany') {\n\t\t\t\t\t\t// For updates, validate the update modifier\n\t\t\t\t\t\tisValid = validationContext.validate(doc.update, { modifier: true });\n\t\t\t\t\t}\n\t\t\t\t\telse if (opType === 'deleteOne' || opType === 'deleteMany') {\n\t\t\t\t\t\t// No validation needed for deletes\n\t\t\t\t\t\tisValid = true;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tthrow new Error(`Unsupported operation type: ${opType}`);\n\t\t\t\t\t}\n\t\n\t\t\t\t\tif (!isValid) {\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t`Schema validation failed for ${opType}: ${JSON.stringify(validationContext.validationErrors())}`\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\t// Now proceed to process the operations\n\t\n\t\t\t\tif (opType === 'insertOne') {\n\t\t\t\t\t// If this.timestamps is true, set createdAt and updatedAt\n\t\t\t\t\tif (this.timestamps) {\n\t\t\t\t\t\tif (!doc.document.createdAt) {\n\t\t\t\t\t\t\tdoc.document.createdAt = new Date();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (!doc.document.updatedAt) {\n\t\t\t\t\t\t\tdoc.document.updatedAt = new Date();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Prepare log entry\n\t\t\t\t\tif (!bypassLogs && this.createLogs) {\n\t\t\t\t\t\tlogs.push({\n\t\t\t\t\t\t\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// eslint-disable-next-line no-unused-vars\n\t\t\tlet { session, ...safeOptions } = options || {};\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 }, sessionOptions).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\tif (!sessionOptions) {\n\t\t\t\t\t\tbwOptions = {ordered: false};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tbwOptions = {session: mongoSession, ordered: false};\n\t\t\t\t\t}\n\n\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').bulkWrite(logs.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<boolean> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\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\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\t\t\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tif ((this.createLogs && !bypassLogs) || this.useVersions) {\n\t\t\tlet docs = await this.find(filter, sessionOptions);\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}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.useVersions) {\n\t\t\t\t\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);\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.acknowledged;\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<boolean> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\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\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tif (this.createLogs && !bypassLogs) {\n\t\t\tlet monitor = MonitorMongo.create('findOneAndDelete', this.collectionName, JSON.stringify([filter, safeOptions]));\n\t\t\t\n\t\t\ttry {\n\t\t\t\tlet returnVal = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).findOneAndDelete(<any>filter, options);\n\t\t\t\tlet doc = returnVal.value;\n\n\t\t\t\tif (doc) {\n\t\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: doc._id as string,\n\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, safeOptions])) < 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}, sessionOptions);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (this.useVersions) {\n\t\t\t\t\t\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);\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\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\treturn true;\n\t\t\t\t}\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.acknowledged;\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\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\tlet sessionOptions = null;\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\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\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}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.useVersions) {\n\t\t\t\t\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);\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\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on findOneAndReplace - ' + this.collectionName, [validation.validationErrors(), replacement]);\n\t\t\t\t\n\t\t\t\tthrow new Error(validation.validationErrors());\n\t\t\t}\n\t\t}\n\t\t\n\t\tlet date = new Date();\n\n\t\tif (this.timestamps) {\n\t\t\treplacement.updatedAt = date;\n\t\t}\n\n\t\tif (options && options.upsert) {\n\t\t\tif (!replacement._id) {\n\t\t\t\treplacement._id = objectIdHexString();\n\t\t\t}\n\n\t\t\tif (this.useVersions) {\n\t\t\t\treplacement.__v = 0;\n\t\t\t}\n\n\t\t\tif (this.timestamps && !replacement.createdAt) {\n\t\t\t\treplacement.createdAt = date;\n\t\t\t}\n\t\t}\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession && (!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\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\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}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.useVersions) {\n\t\t\t\t\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);\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\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on findOneAndUpdate - ' + this.collectionName, [validation.validationErrors(), update]);\n\t\t\t\tthrow new Error(validation.validationErrors());\n\t\t\t}\n\t\t}\n\n\t\tif (this.timestamps) {\n\t\t\tlet date = new Date(); \n\t\t\t\n\t\t\tif (!update.$set) {\n\t\t\t\tupdate.$set = <any>{updatedAt: date};\n\t\t\t}\n\t\t\telse {\n\t\t\t\tupdate.$set.updatedAt = date;\n\t\t\t}\n\t\t}\n\n\t\tif (options && options.upsert) {\n\t\t\tif (!update.$setOnInsert) {\n\t\t\t\tif (this.timestamps) {\n\t\t\t\t\tupdate.$setOnInsert = <any>{\n\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tupdate.$setOnInsert = <any>{\n\t\t\t\t\t\t_id: objectIdHexString()\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (!update.$setOnInsert._id) {\n\t\t\t\t\tupdate.$setOnInsert._id = objectIdHexString();\n\t\t\t\t}\n\n\t\t\t\tif (this.timestamps && !update.$setOnInsert.createdAt) {\n\t\t\t\t\tupdate.$setOnInsert.createdAt = new Date();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession && (!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\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\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}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.useVersions) {\n\t\t\t\t\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);\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\tdocs.forEach(doc => {\n\t\t\t\tconst validation = this.simplschema.newContext();\n\t\t\t\tconst isValid = validation.validate(doc);\n\n\t\t\t\tif (!isValid) {\n\t\t\t\t\tconsole.log(new Date(), this.collectionName, 'Schema Errors - insertMany', validation.validationErrors());\n\t\t\t\t\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on insertMany - ' + this.collectionName, [validation.validationErrors(), doc]);\n\t\t\t\t\tvalidationResults.push(false);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tvalidationResults.push(true);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tlet validDocs = this.checkSchema ? docs.filter((a, idx) => validationResults[idx]) : docs;\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession && (!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\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tfor (let i = 0; i < validDocs.length; i++) {\n\t\t\tlet doc = validDocs[i];\n\n\t\t\tif (!doc._id) {\n\t\t\t\tdoc._id = objectIdHexString();\n\t\t\t}\n\n\t\t\tif (this.timestamps) {\n\t\t\t\tlet date = new Date();\n\n\t\t\t\tif (!doc.createdAt) {\n\t\t\t\t\tdoc.createdAt = date;\n\t\t\t\t}\n\n\t\t\t\tif (!doc.updatedAt) {\n\t\t\t\t\tdoc.updatedAt = date;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.useVersions && !doc.hasOwnProperty('__v')) {\n\t\t\t\tdoc.__v = 0;\n\t\t\t}\n\n\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\tif (\n\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t) {\n\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, safeOptions])) < 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}, sessionOptions);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (validDocs.length) {\n\t\t\tlet monitor = null;\n\t\t\t\n\t\t\tif (!bypassMonitor) {\n\t\t\t\tmonitor = MonitorMongo.create('insertMany', this.collectionName, JSON.stringify([validDocs, safeOptions]));\n\t\t\t}\n\t\t\t\n\t\t\ttry {\n\t\t\t\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\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on insertOne - ' + this.collectionName, [validation.validationErrors(), doc]);\n\t\t\t\tthrow new Error (validation.validationErrors());\n\t\t\t}\n\t\t}\n\n\t\tif (this.timestamps) {\n\t\t\tlet date = new Date();\n\t\t\n\t\t\tif (!doc.createdAt) {\n\t\t\t\tdoc.createdAt = date;\n\t\t\t}\n\n\t\t\tif (!doc.updatedAt) {\n\t\t\t\tdoc.updatedAt = date;\n\t\t\t}\n\t\t}\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession && (!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\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tif (this.createLogs && !bypassLogs) {\n\t\t\tif (\n\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t) {\n\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\ttype: 'log',\n\t\t\t\t\tdata: {\n\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, safeOptions])) < 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}, sessionOptions);\n\t\t\t}\n\t\t}\n\n\t\tif (this.useVersions && !doc.hasOwnProperty('__v')) {\n\t\t\tdoc.__v = 0;\n\t\t}\n\n\t\tlet monitor = MonitorMongo.create('insertOne', this.collectionName, JSON.stringify([doc, safeOptions]));\n\n\t\ttry {\n\t\t\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<number> {\n\t\tif (this.checkSchema && !bypassCheckSchema) {\n\t\t\tconst validation = this.simplschema.newContext();\n\t\t\tconst isValid = validation.validate(replacement);\n\n\t\t\tif (!isValid) {\n\t\t\t\tconsole.log(new Date(), this.collectionName, 'Schema Errors - replaceOne', validation.validationErrors());\n\t\t\t\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on replaceOne - ' + this.collectionName, [validation.validationErrors(), replacement]);\n\t\t\t\tthrow new Error(validation.validationErrors());\n\t\t\t}\n\t\t}\n\t\t\n\t\tlet date = new Date();\n\t\t\n\t\tif (this.timestamps) {\n\t\t\treplacement.updatedAt = date;\n\t\t}\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession && (!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\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tif (this.useVersions) {\n\t\t\tif (!doc) {\n\t\t\t\tdoc = await this.findOne(<any>filter, sessionOptions, 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);\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}, sessionOptions);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tlet monitor = MonitorMongo.create('replaceOne', this.collectionName, JSON.stringify([filter, replacement, safeOptions]));\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).replaceOne(<any>filter, replacement, options);\n\t\t\t\t\t\tif (!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.acknowledged;\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}, sessionOptions);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlet monitor = MonitorMongo.create('replaceOne', this.collectionName, JSON.stringify([filter, updatedDoc, safeOptions]));\n\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).replaceOne(<any>filter, updatedDoc, options);\n\t\t\t\t\t\t\tif (!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}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tlet monitor = MonitorMongo.create('replaceOne', this.collectionName, JSON.stringify([filter, replacement, safeOptions]));\n\n\t\t\t\ttry {\n\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).replaceOne(<any>filter, replacement, options);\n\t\t\t\t\tif (!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\tthrow new Error('Error in Replace One: No Document');\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tif (options && options.upsert) {\n\t\t\t\tif (this.timestamps && !replacement.createdAt) {\n\t\t\t\t\treplacement.createdAt = date;\n\t\t\t\t}\n\n\t\t\t\tif (!replacement._id) {\n\t\t\t\t\treplacement._id = objectIdHexString();\n\t\t\t\t}\n\n\t\t\t\treplacement.__v = 0;\n\t\t\t}\n\n\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\tif (!options) {\n\t\t\t\t\toptions = <FindOneAndReplaceOptions>{returnDocument: 'before'};\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t(<FindOneAndReplaceOptions>options).returnDocument = 'before';\n\t\t\t\t}\n\n\t\t\t\t// eslint-disable-next-line no-unused-vars\n\t\t\t\tlet { session, ...safeOptions } = options || {};\n\n\t\t\t\tlet monitor = MonitorMongo.create('findOneAndReplace', this.collectionName, JSON.stringify([filter, replacement, safeOptions]));\n\n\t\t\t\ttry {\n\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).findOneAndReplace(<any>filter, replacement, <FindOneAndReplaceOptions>options);\n\t\t\t\t\tlet doc = res.value;\n\n\t\t\t\t\tif (doc) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: <string>doc._id,\n\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, replacement, safeOptions])) < 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}, sessionOptions);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: replacement._id,\n\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['upsert', filter, replacement, safeOptions])) < 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}, sessionOptions);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(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<number> {\n\t\tif ((!update.$inc || JSON.stringify(update.$inc) === '{}') && (!update.$set || JSON.stringify(update.$set) === '{}') && (!update.$setOnInsert || JSON.stringify(update.$setOnInsert) === '{}') && (!update.$unset || JSON.stringify(update.$unset) === '{}')) {\n\t\t\treturn 1;\n\t\t}\n\t\t\n\t\tif (this.timestamps) {\n\t\t\tlet date = new Date();\n\n\t\t\tif (!update.$set) {\n\t\t\t\tupdate.$set = <any>{updatedAt: date};\n\t\t\t}\n\t\t\telse {\n\t\t\t\tupdate.$set.updatedAt = date;\n\t\t\t}\n\t\t}\n\n\t\tif (this.checkSchema && !bypassCheckSchema) {\n\t\t\tconst validation = this.simplschema.newContext();\n\t\t\tconst isValid = validation.validate(update, {modifier: true});\n\n\t\t\tif (!isValid) {\n\t\t\t\tconsole.log(new Date(), this.collectionName, 'Schema Errors - updateMany', validation.validationErrors());\n\t\t\t\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on updateMany - ' + this.collectionName, [validation.validationErrors(), update]);\n\t\t\t\tthrow new Error(validation.validationErrors());\n\t\t\t}\n\t\t}\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession && (!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\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tif ((this.useVersions && !bypassVersions) || (this.createLogs && !bypassLogs)) {\n\t\t\tlet docs = await this.find(filter, sessionOptions);\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}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.useVersions) {\n\t\t\t\t\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);\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 (!objectContainsPropertyDeep(update, '__v')) {\n\t\t\t\t\t\tif (!update.$inc) {\n\t\t\t\t\t\t\tupdate.$inc = {__v: 1};\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (!update.$inc.__v) {\n\t\t\t\t\t\t\tupdate.$inc.__v = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tlet monitor = MonitorMongo.create('updateMany', this.collectionName, JSON.stringify([filter, update, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateMany(<any>filter, update, options);\n\t\t\tif (!this.skipCache) {\n\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t}\n\n\t\t\treturn res.acknowledged;\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<boolean> {\n\t\tif (this.checkSchema && !bypassCheckSchema) {\n\t\t\tconst validation = this.simplschema.newContext();\t\t\t\n\t\t\tconst isValid = validation.validate(update, {modifier: true});\n\n\t\t\tif (!isValid) {\n\t\t\t\tconsole.log(new Date(), this.collectionName, 'Schema Errors - updateOne', validation.validationErrors());\n\t\t\t\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on updateOne - ' + this.collectionName, [validation.validationErrors(), update]);\n\t\t\t\tthrow new Error(validation.validationErrors());\n\t\t\t}\n\t\t}\n\n\t\tif ((!update.$inc || JSON.stringify(update.$inc) === '{}') && (!update.$set || JSON.stringify(update.$set) === '{}') && (!update.$setOnInsert || JSON.stringify(update.$setOnInsert) === '{}') && (!update.$unset || JSON.stringify(update.$unset) === '{}')) {\n\t\t\treturn true;\n\t\t}\n\n\t\tlet date = new Date();\n\n\t\tif (this.timestamps) {\n\t\t\tif (!update.$set) {\n\t\t\t\tupdate.$set = <any>{updatedAt: date};\n\t\t\t}\n\t\t\telse {\n\t\t\t\tupdate.$set.updatedAt = date;\n\t\t\t}\n\t\t}\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\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\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\t\t\n\t\tif (this.useVersions) {\n\t\t\tlet doc = await this.findOne(filter, sessionOptions, 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}, sessionOptions);\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);\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 (!objectContainsPropertyDeep(update, '__v')) {\n\t\t\t\t\tif (!update.$inc) {\n\t\t\t\t\t\tupdate.$inc = {__v: 1};\n\t\t\t\t\t}\n\t\t\t\t\telse if (!update.$inc.__v) {\n\t\t\t\t\t\tupdate.$inc.__v = 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tlet monitor = MonitorMongo.create('updateOne', this.collectionName, JSON.stringify([filter, update, safeOptions]));\n\n\t\t\t\ttry {\n\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateOne(<any>filter, update, options);\n\t\t\t\t\tif (!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 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}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tlet monitor = MonitorMongo.create('updateOne', this.collectionName, JSON.stringify([filter, update, safeOptions]));\n\n\t\t\t\ttry {\n\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateOne(<any>filter, update, options);\n\t\t\t\t\tif (!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 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\tthrow new Error('Error in Update One: No Document');\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tif (options && options.upsert) {\n\t\t\t\tif (!update.$setOnInsert) {\n\t\t\t\t\tif (this.timestamps) {\n\t\t\t\t\t\tupdate.$setOnInsert = <any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tupdate.$setOnInsert = <any>{\n\t\t\t\t\t\t\t_id: objectIdHexString()\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (!update.$setOnInsert._id) {\n\t\t\t\t\t\tupdate.$setOnInsert._id = objectIdHexString();\n\t\t\t\t\t}\n\n\t\t\t\t\tif (this.timestamps && !update.$setOnInsert.createdAt) {\n\t\t\t\t\t\tupdate.$setOnInsert.createdAt = new Date();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\tif (!options) {\n\t\t\t\t\toptions = <FindOneAndUpdateOptions>{returnDocument: 'before'};\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t(<FindOneAndUpdateOptions>options).returnDocument = 'before';\n\t\t\t\t}\n\n\t\t\t\tlet monitor = MonitorMongo.create('findOneAndUpdate', this.collectionName, JSON.stringify([filter, update, safeOptions]));\n\n\t\t\t\ttry {\n\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).findOneAndUpdate(<any>filter, update, <FindOneAndUpdateOptions>options);\n\t\t\t\t\tlet doc = res.value;\n\n\t\t\t\t\tif (doc) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: <any>doc._id,\n\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, update, safeOptions])) < 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}, sessionOptions);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn !!res.ok;\n\t\t\t\t\t}\n\t\t\t\t\telse if (update.$setOnInsert) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: update.$setOnInsert._id,\n\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['upsert', filter, update, safeOptions])) < 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\n\t\t\t\t\t\treturn !!res.ok;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\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.acknowledged;\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}\n\nfunction objectContainsPropertyDeep(obj: Object, prop: string) {\n\tlet keys = Object.keys(obj);\n\n\tif (keys.some(a => a === prop)) {\n\t\treturn true;\n\t}\n\t\n\tfor (let i = 0; i < keys.length; i++) {\n\t\tlet key = keys[i];\n\t\tif (obj[key] && typeof obj[key] === 'object' && objectContainsPropertyDeep(obj[key], prop)) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}"]}
|
|
1
|
+
{"version":3,"sources":["../../src/managers/mongo.manager.ts"],"names":["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","attemptCount_1","withTransaction","console","log","serverSession","id","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","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","sessionOptions","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","$lt","res","acknowledged","err_9","deleteOne","findOneAndDelete","returnVal","err_10","err_11","distinct","err_12","drop","err_13","dropIndex","indexName","err_14","dropIndexes","err_15","err_16","findById","err_17","findCount","count","err_18","findCursor","removeAllListeners","findStream","err_19","err_20","findOneAndReplace","validation","getMethodManager","callMethod","call","date","upsert","err_21","findOneAndUpdate","$setOnInsert","err_22","err_23","indexExists","err_24","bypassMonitor","validationResults","forEach","validDocs","idx","hasOwnProperty","err_25","err_26","listIndexes","rename","newName","err_27","err_28","prevDoc","docId","docVersion","updatedDoc","getMongoMergeUpdatedDoc","err_29","err_30","returnDocument","safeOptions_1","doc_1","err_31","err_32","updateMany","$unset","objectContainsPropertyDeep","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","obj","prop"],"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,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AE1C,OAAO,IAAIJ,QAAQ,SAACC,EAASiX,GAAW,OAAAF,OAAOtC,EAAUW,EAAMjV,EAAS,SAAC+W,EAAKb,GAAY,OAACa,EAAMD,EAAOC,CAAG,EAAIlX,EAAQqW,CAAO,CAApC,CAAsC,CAAxF,CAAyF,CAClI,CAEA,SAASH,YAAYiB,GAEpB,OAAO,IAAIpX,QAAQ,SAACC,EAASiX,GAAW,OAAA9b,OAAO+a,YAAYiB,EAAS,SAACD,EAAKf,GAAe,OAACe,EAAMD,EAAOC,CAAG,EAAIlX,EAAQmW,CAAU,CAAvC,CAAyC,CAA1F,CAA2F,CACpI,CAEA,SAASrC,2BAA2BsD,EAAaC,GAChD,IAAI7S,EAAOoG,OAAOpG,KAAK4S,CAAG,EAE1B,GAAI5S,EAAKpF,KAAK,SAAAC,GAAK,OAAAA,IAAMgY,CAAN,CAAU,EAC5B,MAAO,CAAA,EAGR,IAAK,IAAIjI,EAAI,EAAGA,EAAI5K,EAAKjJ,OAAQ6T,CAAC,GAAI,CACrC,IAAItK,EAAMN,EAAK4K,GACf,GAAIgI,EAAItS,IAA4B,UAApB,OAAOsS,EAAItS,IAAqBgP,2BAA2BsD,EAAItS,GAAMuS,CAAI,EACxF,MAAO,CAAA,C,CAIT,MAAO,CAAA,CACR,CArMa/Q,QAAAK,2BAAAA","file":"mongo.manager.js","sourcesContent":["import { AggregateOptions, AggregationCursor, BulkWriteOptions, BulkWriteResult, ChangeStream, ChangeStreamOptions, Collection, CollectionInfo, CommandOperationOptions, CountDocumentsOptions, CreateCollectionOptions, CreateIndexesOptions, CursorStreamOptions, DeleteOptions, FindCursor, FindOneAndDeleteOptions, FindOneAndReplaceOptions, FindOneAndUpdateOptions, FindOptions, IndexDescription, IndexInformationOptions, InsertOneOptions, ListIndexesCursor, ListIndexesOptions, OptionalUnlessRequiredId, RenameOptions, ReplaceOptions, UpdateOptions } from 'mongodb';\nimport * as NodeCache from 'node-cache';\nimport { cpus } from 'os';\nimport SimpleSchema from 'simpl-schema';\nimport { Users } from '../collections/user.collection';\nimport { CollectionDocument, Document } from '../models/collection-document.model';\nimport { LookupTables } from '../models/report-builder.model';\nimport { UserModel } from '../models/user.model';\nimport { ResolveIOServer } from '../resolveio-server-app';\nimport { buildRbLookups, buildRbSchema, dateReviver, deepCopy, getBinarySize, getMongoMergeUpdatedDoc, objectIdHexString } from '../util/common';\nimport { MonitorMongo } from './monitor.manager';\nconst crypto = require('crypto');\nconst scmp = require('scmp');\nconst numCPUs = cpus().length;\nconst v8 = require('v8');\nconst { AsyncLocalStorage } = require('async_hooks');\nconst asyncLocalStorage = new AsyncLocalStorage();\n\n// export declare interface MongoManagerFilterOperators<T> extends Document {\nexport declare interface MongoManagerFilterParamaterOperators<P> {\n\t$eq?: P;\n\t$gt?: P;\n\t$gte?: P;\n\t$in?: P extends Array<any> ? P : P[];\n\t$lt?: P;\n\t$lte?: P;\n\t$ne?: P;\n\t$nin?: P extends Array<any> ? P : P[];\n\t$not?: P extends string ? MongoManagerFilterParamaterOperators<P> | RegExpConstructor : MongoManagerFilterParamaterOperators<P>;\n\t$exists?: boolean;\n\t$expr?: any[]\n\t$regex?: P extends string ? RegExpConstructor | string : never;\n\t$options?: P extends string ? string : never;\n\t$geoIntersects?: {\n\t\t$geometry: Document;\n\t};\n\t$geoWithin?: Document;\n\t$near?: Document;\n\t$nearSphere?: Document;\n\t$maxDistance?: number;\n\t$all?: any[];\n\t$elemMatch?: Document;\n\t$size?: P extends any[] ? number : never;\n}\n\nexport declare interface MongoManagerFilterOperators<T> extends Document { //TODO: Remove extends document when I get answer on S.O.\n\t$and?: MongoManagerFilter<T>[] | MongoManagerFilterOperators<T>;\n\t$nor?: MongoManagerFilter<T>[] | MongoManagerFilterOperators<T>;\n\t$or?: MongoManagerFilter<T>[] | MongoManagerFilterOperators<T>;\n\t$text?: {\n\t\t$search: string;\n\t\t$language?: string;\n\t\t$caseSensitive?: boolean;\n\t\t$diacriticSensitive?: boolean;\n\t};\n\t// eslint-disable-next-line no-unused-vars\n\t$where?: string | ((this: T) => boolean);\n\t$comment?: string | Document;\n}\n\n// function isDotStringRegExp(obj: Object, dotKey: string): boolean {\n// \tlet keyData = dotKey.split('.');\n// \tlet objData = obj;\n\t\n// \tfor (let i = 0; i < keyData.length; i++) {\n// \t\tlet key = keyData[i];\n// \t\tif (objData.hasOwnProperty(key)) {\n// \t\t\tobjData = objData[key];\n\t\t\t\n// \t\t\tif (i === keyData.length - 1) {\n// \t\t\t\treturn true;\n// \t\t\t}\n// \t\t}\n// \t\telse {\n// \t\t\treturn false;\n// \t\t}\n// \t}\n// }\n\n// export declare type MongoManagerDotStringFilter<T> = {\n// \t[key: string]: (isDotStringRegExp(T, key) ? any : never);\n// };\n\nexport declare type MongoManagerFilter<T> = {\n\t[P in keyof T]?: T[P] | MongoManagerFilterParamaterOperators<T[P]>;\n};\n\nexport declare type MongoManagerUnsetFilter<T> = {\n\t// eslint-disable-next-line no-unused-vars\n\t[P in keyof T]?: number | boolean;\n};\n\nexport declare type MongoManagerIncFilter<T> = {\n\t// eslint-disable-next-line no-unused-vars\n\t[P in keyof T]?: number;\n};\n\nexport declare type MongoManagerUpdateFilter<T> = {\n\t$inc?: MongoManagerIncFilter<T> | Document;\n\t$set?: MongoManagerFilter<T> | Document;\n\t$setOnInsert?: MongoManagerFilter<T> | Document;\n\t$unset?: MongoManagerUnsetFilter<T> | Document;\n};\n\nexport class MongoManager {\n\tprivate _collections: MongoManagerCollection<CollectionDocument>[] = [];\n\tprivate _nodeCache;\n\tprivate _cacheMap: { collections: string[], key: string }[] = [];\n\tprivate _operationInProgress: Map<string, { promise: Promise<any>, invalidatedDuringExecution: boolean, collections: string[] }> = new Map();\n\tprivate _heapSize = v8.getHeapStatistics() / numCPUs;\n\tprivate _heapLimit: number;\n\tprivate _serverCollections: (CollectionInfo | Pick<CollectionInfo, 'name' | 'type'>)[] = [];\n\tprivate _isWorkersEnabled = false;\n\tprivate _isWorkerInstance = false;\n\n\tconstructor() {}\n\n\tstatic async create() {\n\t\tconst mongoManager = new MongoManager();\n\t\tawait mongoManager.initialize();\n\t\treturn mongoManager;\n\t}\n\n\tprivate async initialize() {\n\t\tthis._nodeCache = new NodeCache({ stdTTL: 0, checkperiod: 0 });\n\n\t\tthis._isWorkersEnabled = process.env.IS_WORKERS_ENABLED === 'true';\n\t\tthis._isWorkerInstance = process.env.IS_WORKER_INSTANCE === 'true';\n\t\tthis.setCacheLimit();\n\n\t\tif (this._isWorkersEnabled && this._isWorkerInstance) {\n\t\t\tthis.setupChangeStream();\n\t\t}\n\n\t\tlet collections = await ResolveIOServer.getMainDB().listCollections().toArray();\n\t\tthis._serverCollections = collections;\n\t}\n\n\toneTimeTransaction<T>(fn: () => Promise<T>): Promise<T> {\n\t\treturn asyncLocalStorage.run({}, async () => {\n\t\t\tconst session = ResolveIOServer.getMongoConnection().startSession();\n\t\t\tasyncLocalStorage.getStore().session = session;\n\t\n\t\t\ttry {\n\t\t\t\tlet result: T;\n\n\t\t\t\tlet attemptCount = 0;\n\t\t\t\t\n\t\t\t\tawait session.withTransaction(async () => {\n\t\t\t\t\tattemptCount++;\n\t\t\t\t\tconsole.log(\"withTransaction callback invoked, attempt #\", attemptCount, session.serverSession.id);\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\tlet sessionOptions = null;\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\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\t\n\t\twhile (opIndex < operations.length) {\n\t\t\tconst batchOps = operations.slice(opIndex, opIndex + BATCH_SIZE);\n\t\n\t\t\t// Initialize arrays for logs and version operations\n\t\t\tconst logs = [];\n\t\t\tconst versionOps = [];\n\t\n\t\t\tfor (const op of batchOps) {\n\t\t\t\tconst opType = Object.keys(op)[0];\n\t\t\t\tconst doc = op[opType];\n\t\n\t\t\t\t// Skip validation if bypassCheckSchema is true\n\t\t\t\tif (this.checkSchema && !bypassCheckSchema) {\n\t\t\t\t\tconst validationContext = this.simplschema.newContext();\n\t\t\t\t\tlet isValid: boolean;\n\t\n\t\t\t\t\tif (opType === 'insertOne') {\n\t\t\t\t\t\tisValid = validationContext.validate(doc.document);\n\t\t\t\t\t}\n\t\t\t\t\telse if (opType === 'replaceOne') {\n\t\t\t\t\t\tisValid = validationContext.validate(doc.replacement);\n\t\t\t\t\t}\n\t\t\t\t\telse if (opType === 'updateOne' || opType === 'updateMany') {\n\t\t\t\t\t\t// For updates, validate the update modifier\n\t\t\t\t\t\tisValid = validationContext.validate(doc.update, { modifier: true });\n\t\t\t\t\t}\n\t\t\t\t\telse if (opType === 'deleteOne' || opType === 'deleteMany') {\n\t\t\t\t\t\t// No validation needed for deletes\n\t\t\t\t\t\tisValid = true;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tthrow new Error(`Unsupported operation type: ${opType}`);\n\t\t\t\t\t}\n\t\n\t\t\t\t\tif (!isValid) {\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t`Schema validation failed for ${opType}: ${JSON.stringify(validationContext.validationErrors())}`\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\t// Now proceed to process the operations\n\t\n\t\t\t\tif (opType === 'insertOne') {\n\t\t\t\t\t// If this.timestamps is true, set createdAt and updatedAt\n\t\t\t\t\tif (this.timestamps) {\n\t\t\t\t\t\tif (!doc.document.createdAt) {\n\t\t\t\t\t\t\tdoc.document.createdAt = new Date();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (!doc.document.updatedAt) {\n\t\t\t\t\t\t\tdoc.document.updatedAt = new Date();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Prepare log entry\n\t\t\t\t\tif (!bypassLogs && this.createLogs) {\n\t\t\t\t\t\tlogs.push({\n\t\t\t\t\t\t\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// eslint-disable-next-line no-unused-vars\n\t\t\tlet { session, ...safeOptions } = options || {};\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 }, sessionOptions).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\tif (!sessionOptions) {\n\t\t\t\t\t\tbwOptions = {ordered: false};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tbwOptions = {session: mongoSession, ordered: false};\n\t\t\t\t\t}\n\n\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').bulkWrite(logs.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<boolean> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\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\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\t\t\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tif ((this.createLogs && !bypassLogs) || this.useVersions) {\n\t\t\tlet docs = await this.find(filter, sessionOptions);\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}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.useVersions) {\n\t\t\t\t\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);\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.acknowledged;\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<boolean> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\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\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tif (this.createLogs && !bypassLogs) {\n\t\t\tlet monitor = MonitorMongo.create('findOneAndDelete', this.collectionName, JSON.stringify([filter, safeOptions]));\n\t\t\t\n\t\t\ttry {\n\t\t\t\tlet returnVal = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).findOneAndDelete(<any>filter, options);\n\t\t\t\tlet doc = returnVal.value;\n\n\t\t\t\tif (doc) {\n\t\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: doc._id as string,\n\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, safeOptions])) < 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}, sessionOptions);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (this.useVersions) {\n\t\t\t\t\t\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);\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\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\treturn true;\n\t\t\t\t}\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.acknowledged;\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\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\tlet sessionOptions = null;\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\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\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}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.useVersions) {\n\t\t\t\t\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);\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\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on findOneAndReplace - ' + this.collectionName, [validation.validationErrors(), replacement]);\n\t\t\t\t\n\t\t\t\tthrow new Error(validation.validationErrors());\n\t\t\t}\n\t\t}\n\t\t\n\t\tlet date = new Date();\n\n\t\tif (this.timestamps) {\n\t\t\treplacement.updatedAt = date;\n\t\t}\n\n\t\tif (options && options.upsert) {\n\t\t\tif (!replacement._id) {\n\t\t\t\treplacement._id = objectIdHexString();\n\t\t\t}\n\n\t\t\tif (this.useVersions) {\n\t\t\t\treplacement.__v = 0;\n\t\t\t}\n\n\t\t\tif (this.timestamps && !replacement.createdAt) {\n\t\t\t\treplacement.createdAt = date;\n\t\t\t}\n\t\t}\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession && (!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\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\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}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.useVersions) {\n\t\t\t\t\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);\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\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on findOneAndUpdate - ' + this.collectionName, [validation.validationErrors(), update]);\n\t\t\t\tthrow new Error(validation.validationErrors());\n\t\t\t}\n\t\t}\n\n\t\tif (this.timestamps) {\n\t\t\tlet date = new Date(); \n\t\t\t\n\t\t\tif (!update.$set) {\n\t\t\t\tupdate.$set = <any>{updatedAt: date};\n\t\t\t}\n\t\t\telse {\n\t\t\t\tupdate.$set.updatedAt = date;\n\t\t\t}\n\t\t}\n\n\t\tif (options && options.upsert) {\n\t\t\tif (!update.$setOnInsert) {\n\t\t\t\tif (this.timestamps) {\n\t\t\t\t\tupdate.$setOnInsert = <any>{\n\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tupdate.$setOnInsert = <any>{\n\t\t\t\t\t\t_id: objectIdHexString()\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (!update.$setOnInsert._id) {\n\t\t\t\t\tupdate.$setOnInsert._id = objectIdHexString();\n\t\t\t\t}\n\n\t\t\t\tif (this.timestamps && !update.$setOnInsert.createdAt) {\n\t\t\t\t\tupdate.$setOnInsert.createdAt = new Date();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession && (!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\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\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}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.useVersions) {\n\t\t\t\t\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);\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\tdocs.forEach(doc => {\n\t\t\t\tconst validation = this.simplschema.newContext();\n\t\t\t\tconst isValid = validation.validate(doc);\n\n\t\t\t\tif (!isValid) {\n\t\t\t\t\tconsole.log(new Date(), this.collectionName, 'Schema Errors - insertMany', validation.validationErrors());\n\t\t\t\t\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on insertMany - ' + this.collectionName, [validation.validationErrors(), doc]);\n\t\t\t\t\tvalidationResults.push(false);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tvalidationResults.push(true);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tlet validDocs = this.checkSchema ? docs.filter((a, idx) => validationResults[idx]) : docs;\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession && (!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\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tfor (let i = 0; i < validDocs.length; i++) {\n\t\t\tlet doc = validDocs[i];\n\n\t\t\tif (!doc._id) {\n\t\t\t\tdoc._id = objectIdHexString();\n\t\t\t}\n\n\t\t\tif (this.timestamps) {\n\t\t\t\tlet date = new Date();\n\n\t\t\t\tif (!doc.createdAt) {\n\t\t\t\t\tdoc.createdAt = date;\n\t\t\t\t}\n\n\t\t\t\tif (!doc.updatedAt) {\n\t\t\t\t\tdoc.updatedAt = date;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.useVersions && !doc.hasOwnProperty('__v')) {\n\t\t\t\tdoc.__v = 0;\n\t\t\t}\n\n\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\tif (\n\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t) {\n\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, safeOptions])) < 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}, sessionOptions);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (validDocs.length) {\n\t\t\tlet monitor = null;\n\t\t\t\n\t\t\tif (!bypassMonitor) {\n\t\t\t\tmonitor = MonitorMongo.create('insertMany', this.collectionName, JSON.stringify([validDocs, safeOptions]));\n\t\t\t}\n\t\t\t\n\t\t\ttry {\n\t\t\t\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\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on insertOne - ' + this.collectionName, [validation.validationErrors(), doc]);\n\t\t\t\tthrow new Error (validation.validationErrors());\n\t\t\t}\n\t\t}\n\n\t\tif (this.timestamps) {\n\t\t\tlet date = new Date();\n\t\t\n\t\t\tif (!doc.createdAt) {\n\t\t\t\tdoc.createdAt = date;\n\t\t\t}\n\n\t\t\tif (!doc.updatedAt) {\n\t\t\t\tdoc.updatedAt = date;\n\t\t\t}\n\t\t}\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession && (!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\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tif (this.createLogs && !bypassLogs) {\n\t\t\tif (\n\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t) {\n\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\ttype: 'log',\n\t\t\t\t\tdata: {\n\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, safeOptions])) < 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}, sessionOptions);\n\t\t\t}\n\t\t}\n\n\t\tif (this.useVersions && !doc.hasOwnProperty('__v')) {\n\t\t\tdoc.__v = 0;\n\t\t}\n\n\t\tlet monitor = MonitorMongo.create('insertOne', this.collectionName, JSON.stringify([doc, safeOptions]));\n\n\t\ttry {\n\t\t\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<number> {\n\t\tif (this.checkSchema && !bypassCheckSchema) {\n\t\t\tconst validation = this.simplschema.newContext();\n\t\t\tconst isValid = validation.validate(replacement);\n\n\t\t\tif (!isValid) {\n\t\t\t\tconsole.log(new Date(), this.collectionName, 'Schema Errors - replaceOne', validation.validationErrors());\n\t\t\t\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on replaceOne - ' + this.collectionName, [validation.validationErrors(), replacement]);\n\t\t\t\tthrow new Error(validation.validationErrors());\n\t\t\t}\n\t\t}\n\t\t\n\t\tlet date = new Date();\n\t\t\n\t\tif (this.timestamps) {\n\t\t\treplacement.updatedAt = date;\n\t\t}\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession && (!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\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tif (this.useVersions) {\n\t\t\tif (!doc) {\n\t\t\t\tdoc = await this.findOne(<any>filter, sessionOptions, 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);\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}, sessionOptions);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tlet monitor = MonitorMongo.create('replaceOne', this.collectionName, JSON.stringify([filter, replacement, safeOptions]));\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).replaceOne(<any>filter, replacement, options);\n\t\t\t\t\t\tif (!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.acknowledged;\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}, sessionOptions);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlet monitor = MonitorMongo.create('replaceOne', this.collectionName, JSON.stringify([filter, updatedDoc, safeOptions]));\n\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).replaceOne(<any>filter, updatedDoc, options);\n\t\t\t\t\t\t\tif (!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}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tlet monitor = MonitorMongo.create('replaceOne', this.collectionName, JSON.stringify([filter, replacement, safeOptions]));\n\n\t\t\t\ttry {\n\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).replaceOne(<any>filter, replacement, options);\n\t\t\t\t\tif (!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\tthrow new Error('Error in Replace One: No Document');\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tif (options && options.upsert) {\n\t\t\t\tif (this.timestamps && !replacement.createdAt) {\n\t\t\t\t\treplacement.createdAt = date;\n\t\t\t\t}\n\n\t\t\t\tif (!replacement._id) {\n\t\t\t\t\treplacement._id = objectIdHexString();\n\t\t\t\t}\n\n\t\t\t\treplacement.__v = 0;\n\t\t\t}\n\n\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\tif (!options) {\n\t\t\t\t\toptions = <FindOneAndReplaceOptions>{returnDocument: 'before'};\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t(<FindOneAndReplaceOptions>options).returnDocument = 'before';\n\t\t\t\t}\n\n\t\t\t\t// eslint-disable-next-line no-unused-vars\n\t\t\t\tlet { session, ...safeOptions } = options || {};\n\n\t\t\t\tlet monitor = MonitorMongo.create('findOneAndReplace', this.collectionName, JSON.stringify([filter, replacement, safeOptions]));\n\n\t\t\t\ttry {\n\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).findOneAndReplace(<any>filter, replacement, <FindOneAndReplaceOptions>options);\n\t\t\t\t\tlet doc = res.value;\n\n\t\t\t\t\tif (doc) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: <string>doc._id,\n\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, replacement, safeOptions])) < 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}, sessionOptions);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: replacement._id,\n\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['upsert', filter, replacement, safeOptions])) < 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}, sessionOptions);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(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<number> {\n\t\tif ((!update.$inc || JSON.stringify(update.$inc) === '{}') && (!update.$set || JSON.stringify(update.$set) === '{}') && (!update.$setOnInsert || JSON.stringify(update.$setOnInsert) === '{}') && (!update.$unset || JSON.stringify(update.$unset) === '{}')) {\n\t\t\treturn 1;\n\t\t}\n\t\t\n\t\tif (this.timestamps) {\n\t\t\tlet date = new Date();\n\n\t\t\tif (!update.$set) {\n\t\t\t\tupdate.$set = <any>{updatedAt: date};\n\t\t\t}\n\t\t\telse {\n\t\t\t\tupdate.$set.updatedAt = date;\n\t\t\t}\n\t\t}\n\n\t\tif (this.checkSchema && !bypassCheckSchema) {\n\t\t\tconst validation = this.simplschema.newContext();\n\t\t\tconst isValid = validation.validate(update, {modifier: true});\n\n\t\t\tif (!isValid) {\n\t\t\t\tconsole.log(new Date(), this.collectionName, 'Schema Errors - updateMany', validation.validationErrors());\n\t\t\t\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on updateMany - ' + this.collectionName, [validation.validationErrors(), update]);\n\t\t\t\tthrow new Error(validation.validationErrors());\n\t\t\t}\n\t\t}\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession && (!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\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tif ((this.useVersions && !bypassVersions) || (this.createLogs && !bypassLogs)) {\n\t\t\tlet docs = await this.find(filter, sessionOptions);\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}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.useVersions) {\n\t\t\t\t\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);\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 (!objectContainsPropertyDeep(update, '__v')) {\n\t\t\t\t\t\tif (!update.$inc) {\n\t\t\t\t\t\t\tupdate.$inc = {__v: 1};\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (!update.$inc.__v) {\n\t\t\t\t\t\t\tupdate.$inc.__v = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tlet monitor = MonitorMongo.create('updateMany', this.collectionName, JSON.stringify([filter, update, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateMany(<any>filter, update, options);\n\t\t\tif (!this.skipCache) {\n\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t}\n\n\t\t\treturn res.acknowledged;\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<boolean> {\n\t\tif (this.checkSchema && !bypassCheckSchema) {\n\t\t\tconst validation = this.simplschema.newContext();\t\t\t\n\t\t\tconst isValid = validation.validate(update, {modifier: true});\n\n\t\t\tif (!isValid) {\n\t\t\t\tconsole.log(new Date(), this.collectionName, 'Schema Errors - updateOne', validation.validationErrors());\n\t\t\t\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on updateOne - ' + this.collectionName, [validation.validationErrors(), update]);\n\t\t\t\tthrow new Error(validation.validationErrors());\n\t\t\t}\n\t\t}\n\n\t\tif ((!update.$inc || JSON.stringify(update.$inc) === '{}') && (!update.$set || JSON.stringify(update.$set) === '{}') && (!update.$setOnInsert || JSON.stringify(update.$setOnInsert) === '{}') && (!update.$unset || JSON.stringify(update.$unset) === '{}')) {\n\t\t\treturn true;\n\t\t}\n\n\t\tlet date = new Date();\n\n\t\tif (this.timestamps) {\n\t\t\tif (!update.$set) {\n\t\t\t\tupdate.$set = <any>{updatedAt: date};\n\t\t\t}\n\t\t\telse {\n\t\t\t\tupdate.$set.updatedAt = date;\n\t\t\t}\n\t\t}\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\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\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\t// eslint-disable-next-line no-unused-vars\n\t\tlet { session, ...safeOptions } = options || {};\n\t\t\n\t\tif (this.useVersions) {\n\t\t\tlet doc = await this.findOne(filter, sessionOptions, 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}, sessionOptions);\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);\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 (!objectContainsPropertyDeep(update, '__v')) {\n\t\t\t\t\tif (!update.$inc) {\n\t\t\t\t\t\tupdate.$inc = {__v: 1};\n\t\t\t\t\t}\n\t\t\t\t\telse if (!update.$inc.__v) {\n\t\t\t\t\t\tupdate.$inc.__v = 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tlet monitor = MonitorMongo.create('updateOne', this.collectionName, JSON.stringify([filter, update, safeOptions]));\n\n\t\t\t\ttry {\n\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateOne(<any>filter, update, options);\n\t\t\t\t\tif (!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 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}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tlet monitor = MonitorMongo.create('updateOne', this.collectionName, JSON.stringify([filter, update, safeOptions]));\n\n\t\t\t\ttry {\n\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateOne(<any>filter, update, options);\n\t\t\t\t\tif (!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 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\tthrow new Error('Error in Update One: No Document');\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tif (options && options.upsert) {\n\t\t\t\tif (!update.$setOnInsert) {\n\t\t\t\t\tif (this.timestamps) {\n\t\t\t\t\t\tupdate.$setOnInsert = <any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tupdate.$setOnInsert = <any>{\n\t\t\t\t\t\t\t_id: objectIdHexString()\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (!update.$setOnInsert._id) {\n\t\t\t\t\t\tupdate.$setOnInsert._id = objectIdHexString();\n\t\t\t\t\t}\n\n\t\t\t\t\tif (this.timestamps && !update.$setOnInsert.createdAt) {\n\t\t\t\t\t\tupdate.$setOnInsert.createdAt = new Date();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\tif (!options) {\n\t\t\t\t\toptions = <FindOneAndUpdateOptions>{returnDocument: 'before'};\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t(<FindOneAndUpdateOptions>options).returnDocument = 'before';\n\t\t\t\t}\n\n\t\t\t\tlet monitor = MonitorMongo.create('findOneAndUpdate', this.collectionName, JSON.stringify([filter, update, safeOptions]));\n\n\t\t\t\ttry {\n\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).findOneAndUpdate(<any>filter, update, <FindOneAndUpdateOptions>options);\n\t\t\t\t\tlet doc = res.value;\n\n\t\t\t\t\tif (doc) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: <any>doc._id,\n\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, update, safeOptions])) < 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}, sessionOptions);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn !!res.ok;\n\t\t\t\t\t}\n\t\t\t\t\telse if (update.$setOnInsert) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: update.$setOnInsert._id,\n\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['upsert', filter, update, safeOptions])) < 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\n\t\t\t\t\t\treturn !!res.ok;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\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.acknowledged;\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}\n\nfunction objectContainsPropertyDeep(obj: Object, prop: string) {\n\tlet keys = Object.keys(obj);\n\n\tif (keys.some(a => a === prop)) {\n\t\treturn true;\n\t}\n\t\n\tfor (let i = 0; i < keys.length; i++) {\n\t\tlet key = keys[i];\n\t\tif (obj[key] && typeof obj[key] === 'object' && objectContainsPropertyDeep(obj[key], prop)) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}"]}
|