@resolveio/server-lib 20.7.7 → 20.7.8

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.
Files changed (54) hide show
  1. package/collections/app-status.collection.js +1 -1
  2. package/collections/app-status.collection.js.map +1 -1
  3. package/collections/counter.collection.js +1 -1
  4. package/collections/counter.collection.js.map +1 -1
  5. package/collections/cron-job-history.collection.js +1 -1
  6. package/collections/cron-job-history.collection.js.map +1 -1
  7. package/collections/cron-job.collection.js +1 -1
  8. package/collections/cron-job.collection.js.map +1 -1
  9. package/collections/email-history.collection.js +1 -1
  10. package/collections/email-history.collection.js.map +1 -1
  11. package/collections/email-verified.collection.js +1 -1
  12. package/collections/email-verified.collection.js.map +1 -1
  13. package/collections/file.collection.js +1 -1
  14. package/collections/file.collection.js.map +1 -1
  15. package/collections/flag-update.collection.js +1 -1
  16. package/collections/flag-update.collection.js.map +1 -1
  17. package/collections/flag.collection.js +1 -1
  18. package/collections/flag.collection.js.map +1 -1
  19. package/collections/log-method-latency.collection.js +1 -1
  20. package/collections/log-method-latency.collection.js.map +1 -1
  21. package/collections/log-subscription.collection.js +1 -1
  22. package/collections/log-subscription.collection.js.map +1 -1
  23. package/collections/log.collection.js +1 -1
  24. package/collections/log.collection.js.map +1 -1
  25. package/collections/logged-in-users.collection.js +1 -1
  26. package/collections/logged-in-users.collection.js.map +1 -1
  27. package/collections/method-response.collection.js +1 -1
  28. package/collections/method-response.collection.js.map +1 -1
  29. package/collections/monitor-cpu.collection.js +1 -1
  30. package/collections/monitor-cpu.collection.js.map +1 -1
  31. package/collections/monitor-function.collection.js +1 -1
  32. package/collections/monitor-function.collection.js.map +1 -1
  33. package/collections/monitor-memory.collection.js +1 -1
  34. package/collections/monitor-memory.collection.js.map +1 -1
  35. package/collections/monitor-mongo.collection.js +1 -1
  36. package/collections/monitor-mongo.collection.js.map +1 -1
  37. package/collections/notification.collection.js +1 -1
  38. package/collections/notification.collection.js.map +1 -1
  39. package/collections/report-builder-dashboard-builder.collection.js +1 -1
  40. package/collections/report-builder-dashboard-builder.collection.js.map +1 -1
  41. package/collections/report-builder-library.collection.js +1 -1
  42. package/collections/report-builder-library.collection.js.map +1 -1
  43. package/collections/report-builder-report.collection.js +1 -1
  44. package/collections/report-builder-report.collection.js.map +1 -1
  45. package/collections/user-group.collection.js +1 -1
  46. package/collections/user-group.collection.js.map +1 -1
  47. package/collections/user-guide.collection.js +1 -1
  48. package/collections/user-guide.collection.js.map +1 -1
  49. package/collections/user.collection.js +1 -1
  50. package/collections/user.collection.js.map +1 -1
  51. package/managers/mongo.manager.d.ts +1 -1
  52. package/managers/mongo.manager.js +1 -1
  53. package/managers/mongo.manager.js.map +1 -1
  54. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/managers/mongo.manager.ts"],"names":["async_1","require","NodeCache","os_1","simpl_schema_1","user_collection_1","resolveio_server_app_1","common_1","monitor_manager_1","crypto","scmp","numCPUs","cpus","length","v8","AsyncLocalStorage","asyncLocalStorage","MongoManager","this","_collections","_cacheMap","_operationInProgress","Map","_heapSize","getHeapStatistics","_serverCollections","_isWorkersEnabled","_isWorkerInstance","create","mongoManager","initialize","_a","sent","prototype","_nodeCache","stdTTL","checkperiod","process","env","IS_WORKERS_ENABLED","IS_WORKER_INSTANCE","setCacheLimit","setupChangeStream","ResolveIOServer","getMainDB","listCollections","toArray","collections","oneTimeTransaction","fn","run","__awaiter","_this","session","getMongoConnection","startSession","getStore","withTransaction","endSession","store","getSession","_heapLimit","getServerCollections","registerCollection","collection","collectionOptions","timeseries","timeField","some","a","name","collectionName","type","dropCollection","createCollection","push","find","delay","ms","Promise","resolve","setTimeout","filter","options","safeOptions","__rest","cacheKey","generateCacheKey","undefined","result","getFromCache","getMainServer","getSubscriptionManager","getEnableDebug","console","log","Date","has","get","promise","operation","executeFind","set","invalidatedDuringExecution","finally","delete","_b","monitor","MonitorMongo","JSON","stringify","message","concat","err_2","finish","addToCache","findOne","executeFindOne","err_3","aggregate","pipeline","__spreadArray","__read","flatMap","stage","$lookup","from","executeAggregate","err_4","countDocuments","executeCountDocuments","err_5","functionName","args","keyString","createHash","update","digest","cachedData","parse","dateReviver","error","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","err","close","MongoManagerModel","exports","collection_main","collection_version","mongoManagerModel","MongoManagerUserCollection","MongoManagerCollection","useVersionCollection","useVersions","versionSchema","deepCopy","schema","_id","blackbox","versionOptions","useReportBuilder","reportBuilderLookupTables","timestamps","createLogs","checkSchema","skipCache","createIndex","_id._id","_id.__v","versionCollection","simplschema","rbSchema","useRB","bypassSession","mongoManagerCollection","schemaCopy","interval","default","buildRbLookups","buildRbSchema","setInterval","getMongoManager","clearInterval","extractIndexNameFromError","errorMessage","matches","match","mongoSession","err_6","aggregateCount","err_7","aggregateCursor","cursor","ev","aggregateStream","streamOptions","stream","bulkWrite","operations","bypassCheckSchema","bypassLogs","bypassVersions","BATCH_SIZE","opIndex","sessionOptions","batchOps","slice","logs","versionOps","e_5","batchOps_1","batchOps_1_1","op","opType","Object","doc","validationContext","newContext","isValid","validate","document","replacement","modifier","Error","validationErrors","createdAt","updatedAt","insertOne","objectIdHexString","id_document","payload","method","id_user","user","messageId","route","versionDoc","__assign","__v","$set","$inc","affectedDocs","versionFilters","map","v","$or","versionInserts","bwOptions","ordered","e_4","err_8","getServerConfig","getLocalLogManager","writeLogs","affectedDocIds","$in","$sort","$group","versions","$push","$project","versionsToDelete","$slice","$size","$unwind","$replaceRoot","newRoot","oldVersions","deleteMany","error_1","setImmediate","ok","estimatedDocumentCount","err_9","f_docs","Array","isArray","insertMany","fieldOrSpec","indexes","existingIndexes","index","indexQueue","action","specs","createIndexes","indexSpecs","existingIndexes_1","indexesToCreate","indexSpec","existingIndex","docs","i","writeLog","upsert","replaceOne","$lt","res","acknowledged","deletedCount","err_12","deleteOne","findOneAndDelete","returnVal","err_13","err_14","distinct","err_15","drop","err_16","dropIndex","indexName","err_17","dropIndexes","err_18","err_19","findById","id","err_20","findCount","count","err_21","findCursor","removeAllListeners","findStream","err_22","err_23","findOneAndReplace","validation","getMethodManager","callMethod","call","date","err_24","findOneAndUpdate","$setOnInsert","err_25","err_26","indexExists","err_27","bypassMonitor","validationResults","forEach","validDocs","idx","hasOwnProperty","err_28","err_29","listIndexes","rename","newName","err_30","modifiedCount","err_31","prevDoc","docId","docVersion","updatedDoc","getMongoMergeUpdatedDoc","err_32","err_33","returnDocument","safeOptions_1","doc_1","err_34","err_35","updateMany","$unset","objectContainsPropertyDeep","err_36","updateOne","err_37","err_38","err_39","err_40","watchCollection","queue","task","callback","dbCollection","apply","code","err_41","existingIndexName","innerError_1","_super","__extends","authenticate","password","attemptsInterval","Math","pow","attempts","calculatedInterval","last","now","getTime","Users","salt","pbkdf2Promisified","iterations","keylen","digestAlgorithm","hashBuffer","Buffer","hash","err_42","serializeUser","cb","username","deserializeUser","setPassword","randomBytes","saltBuffer","toString","hashRaw","services","err_43","changePassword","oldPassword","newPassword","authUser","register","email","resetAttempts","pbkdf2","reject","saltlen","obj","prop"],"mappings":"02GAAAA,S,+KAAAC,QAAA,OAAA,GAEAC,UAAAD,QAAA,YAAA,EACAE,KAAAF,QAAA,IAAA,EACAG,eAAAH,QAAA,cAAA,EACAI,kBAAAJ,QAAA,gCAAA,EAIAK,uBAAAL,QAAA,yBAAA,EACAM,SAAAN,QAAA,gBAAA,EACAO,kBAAAP,QAAA,mBAAA,EACMQ,OAASR,QAAQ,QAAQ,EACzBS,KAAOT,QAAQ,MAAM,EACrBU,SAAU,EAAAR,KAAAS,MAAI,EAAGC,OACjBC,GAAKb,QAAQ,IAAI,EACfc,kBAAsBd,QAAQ,aAAa,EAACc,kBAC9CC,kBAAo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,CAApC,CAAsC,CAAxF,CAAyF,CAClI,CAEA,SAASH,YAAYe,GAEpB,OAAO,IAAIjY,QAAQ,SAACC,EAAS+X,GAAW,OAAAtc,OAAOwb,YAAYe,EAAS,SAAC5R,EAAK8Q,GAAe,OAAC9Q,EAAM2R,EAAO3R,CAAG,EAAIpG,EAAQkX,CAAU,CAAvC,CAAyC,CAA1F,CAA2F,CACpI,CAEA,SAAS7C,2BAA2B4D,EAAaC,GAChD,IAAI1T,EAAOmG,OAAOnG,KAAKyT,CAAG,EAE1B,GAAIzT,EAAKpF,KAAK,SAAAC,GAAK,OAAAA,IAAM6Y,CAAN,CAAU,EAC5B,MAAO,CAAA,EAGR,IAAK,IAAIzI,EAAI,EAAGA,EAAIjL,EAAK3I,OAAQ4T,CAAC,GAAI,CACrC,IAAI3K,EAAMN,EAAKiL,GACf,GAAIwI,EAAInT,IAA4B,UAApB,OAAOmT,EAAInT,IAAqBuP,2BAA2B4D,EAAInT,GAAMoT,CAAI,EACxF,MAAO,CAAA,C,CAIT,MAAO,CAAA,CACR,CA/La3R,QAAAI,2BAAAA","file":"mongo.manager.js","sourcesContent":["import async from 'async';\nimport { AggregateOptions, AggregationCursor, BulkWriteOptions, BulkWriteResult, ChangeStream, ChangeStreamOptions, Collection, CollectionInfo, CommandOperationOptions, CountDocumentsOptions, CreateCollectionOptions, CreateIndexesOptions, CursorStreamOptions, DeleteOptions, FindCursor, FindOneAndDeleteOptions, FindOneAndReplaceOptions, FindOneAndUpdateOptions, FindOptions, IndexDescription, IndexInformationOptions, InsertOneOptions, ListIndexesCursor, ListIndexesOptions, OptionalUnlessRequiredId, RenameOptions, ReplaceOptions, UpdateOptions } from 'mongodb';\nimport * as NodeCache from 'node-cache';\nimport { cpus } from 'os';\nimport SimpleSchema from 'simpl-schema';\nimport { Users } from '../collections/user.collection';\nimport { CollectionDocument, Document } from '../models/collection-document.model';\nimport { LookupTables } from '../models/report-builder.model';\nimport { UserModel } from '../models/user.model';\nimport { ResolveIOServer } from '../resolveio-server-app';\nimport { buildRbLookups, buildRbSchema, dateReviver, deepCopy, getBinarySize, getMongoMergeUpdatedDoc, objectIdHexString } from '../util/common';\nimport { MonitorMongo } from './monitor.manager';\nconst crypto = require('crypto');\nconst scmp = require('scmp');\nconst numCPUs = cpus().length;\nconst v8 = require('v8');\nconst { AsyncLocalStorage } = require('async_hooks');\nconst asyncLocalStorage = new AsyncLocalStorage();\n\n// export declare interface MongoManagerFilterOperators<T> extends Document {\nexport declare interface MongoManagerFilterParamaterOperators<P> {\n\t$eq?: P;\n\t$gt?: P;\n\t$gte?: P;\n\t$in?: P extends Array<any> ? P : P[];\n\t$lt?: P;\n\t$lte?: P;\n\t$ne?: P;\n\t$nin?: P extends Array<any> ? P : P[];\n\t$not?: P extends string ? MongoManagerFilterParamaterOperators<P> | RegExpConstructor : MongoManagerFilterParamaterOperators<P>;\n\t$exists?: boolean;\n\t$expr?: any[]\n\t$regex?: P extends string ? RegExpConstructor | string : never;\n\t$options?: P extends string ? string : never;\n\t$geoIntersects?: {\n\t\t$geometry: Document;\n\t};\n\t$geoWithin?: Document;\n\t$near?: Document;\n\t$nearSphere?: Document;\n\t$maxDistance?: number;\n\t$all?: any[];\n\t$elemMatch?: Document;\n\t$size?: P extends any[] ? number : never;\n}\n\nexport declare interface MongoManagerFilterOperators<T> extends Document { //TODO: Remove extends document when I get answer on S.O.\n\t$and?: MongoManagerFilter<T>[] | MongoManagerFilterOperators<T>;\n\t$nor?: MongoManagerFilter<T>[] | MongoManagerFilterOperators<T>;\n\t$or?: MongoManagerFilter<T>[] | MongoManagerFilterOperators<T>;\n\t$text?: {\n\t\t$search: string;\n\t\t$language?: string;\n\t\t$caseSensitive?: boolean;\n\t\t$diacriticSensitive?: boolean;\n\t};\n\t$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[P in keyof T]?: number | boolean;\n};\n\nexport declare type MongoManagerIncFilter<T> = {\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\tasync oneTimeTransaction<T>(fn: () => Promise<T>): Promise<T> {\n\t\treturn await asyncLocalStorage.run({}, async () => {\n\t\t\tconst session = ResolveIOServer.getMongoConnection().startSession();\n\t\t\tasyncLocalStorage.getStore().session = session;\n\n\t\t\ttry {\n\t\t\t\t// Let withTransaction return the value from fn()\n\t\t\t\treturn await session.withTransaction(async () => {\n\t\t\t\t\treturn fn();\n\t\t\t\t});\n\t\t\t} \n\t\t\tcatch (err) {\n\t\t\t\tthrow err;\n\t\t\t} \n\t\t\tfinally {\n\t\t\t\tawait session.endSession();\n\t\t\t\t\n\t\t\t\tlet store = asyncLocalStorage.getStore();\n\t\t\t\tif (store) {\n\t\t\t\t\tdelete store.session; // or store.session = undefined\n\t\t\t\t}\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\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\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(<any>filter, options).toArray();\n\t\t}\n\t\tcatch (err) {\n\t\t\terr.message = `Error in Execute Find (${collectionName}): ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t\n\t\tif (!this._operationInProgress.get(cacheKey).invalidatedDuringExecution) {\n\t\t\tthis.addToCache([collectionName], cacheKey, result);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t// FindOne Operation\n\tpublic async findOne<T extends CollectionDocument>(\n\t\tcollectionName: string,\n\t\tfilter: MongoManagerFilter<T> | MongoManagerFilterOperators<T> = {},\n\t\toptions?: FindOptions<T>\n\t): Promise<T> {\n\t\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\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(<any>filter, options);\n\t\t}\n\t\tcatch (err) {\n\t\t\terr.message = `Error in Execute Find One (${collectionName}): ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t\n\t\tif (!this._operationInProgress.get(cacheKey).invalidatedDuringExecution) {\n\t\t\tthis.addToCache([collectionName], cacheKey, result);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t// Aggregate Operation\n\tpublic async aggregate<T extends CollectionDocument>(\n\t\tcollectionName: string,\n\t\tpipeline: any[],\n\t\toptions?: AggregateOptions\n\t): Promise<any[]> {\n\t\tconst collections = [collectionName, ...pipeline.flatMap(stage => stage.$lookup?.from ? [stage.$lookup.from] : [])];\n\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\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(pipeline, options).toArray();\n\t\t}\n\t\tcatch (err) {\n\t\t\terr.message = `Error in Execute Aggregate (${collectionName}): ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\n\t\tif (!this._operationInProgress.get(cacheKey).invalidatedDuringExecution) {\n\t\t\tthis.addToCache(collections, cacheKey, result);\n\t\t}\n\t\t\n\t\treturn result;\n\t}\n\n\tpublic async countDocuments<T extends CollectionDocument>(\n\t\tcollectionName: string,\n\t\tfilter: MongoManagerFilter<T> | MongoManagerFilterOperators<T> = {},\n\t\toptions?: CountDocumentsOptions\n\t): Promise<number> {\n\t\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\tlet { session, ...safeOptions } = options || {};\n\t\tconst monitor = MonitorMongo.create('countDocuments', collectionName, JSON.stringify([filter, safeOptions]));\n\n\t\ttry {\n\t\t\tresult = await collection.countDocuments(<any>filter, options);\n\t\t}\n\t\tcatch (err) {\n\t\t\terr.message = `Error in Execute Count Documents (${collectionName}): ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t\n\t\tif (!this._operationInProgress.get(cacheKey).invalidatedDuringExecution) {\n\t\t\tthis.addToCache([collectionName], cacheKey, result);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t// Cache and Invalidation Setup\n\tprivate generateCacheKey(collections: string[], functionName: string, args: any[]): string {\n\t\tconst keyString = JSON.stringify({ collections, functionName, args });\n\t\treturn crypto.createHash('sha256').update(keyString).digest('hex');\n\t}\n\n\tprivate getFromCache(cacheKey: string): any | undefined {\n\t\ttry {\n\t\t\tconst cachedData = this._nodeCache.get(cacheKey);\n\t\t\tif (cachedData) {\n\t\t\t\treturn JSON.parse(cachedData, dateReviver);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tthis._nodeCache.del(cacheKey);\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate addToCache(collections: string[], cacheKey: string, data: any) {\n\t\tif (getBinarySize(JSON.stringify(data)) < 1000000 && \n\t\t\t!collections.includes('logs') &&\n\t\t\t!collections.find(a => a.endsWith('.versions')) &&\n\t\t\t!collections.find(a => a.startsWith('monitor-'))\n\t\t) {\n\t\t\tlet nodeCacheSize = this._nodeCache.getStats().vsize;\n\n\t\t\tif (nodeCacheSize > this._heapLimit) {\n\t\t\t\tlet deleteCount = 0;\n\t\t\t\tconst keys = this._nodeCache.keys();\n\n\t\t\t\tfor (const key of keys) {\n\t\t\t\t\tthis._nodeCache.del(key);\n\t\t\t\t\tdeleteCount += 1;\n\n\t\t\t\t\tnodeCacheSize = this._nodeCache.getStats().vsize;\n\n\t\t\t\t\tif (nodeCacheSize < this._heapLimit * 0.75) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconsole.log('Query Cache: ' + 'Too Big, - Deleted: ' + deleteCount + ' - ' + nodeCacheSize);\n\t\t\t}\n\t\t\t\n\t\t\tthis._nodeCache.set(cacheKey, JSON.stringify(data));\n\t\t\tthis._cacheMap.push({ collections, key: cacheKey });\n\t\t}\n\t}\n\n\tpublic invalidateQueryCache(collection: string) {\n\t\tconst collectionCacheMap = this._cacheMap.filter(a => a.collections.includes(collection));\n\n\t\tif (ResolveIOServer.getMainServer().getSubscriptionManager() && ResolveIOServer.getMainServer().getSubscriptionManager().getEnableDebug()) {\n\t\t\tconsole.log(new Date(), 'Mongo Invalidate Cache', collection);\n\t\t}\n\n\t\tfor (const cacheMap of collectionCacheMap) {\n\t\t\tthis._nodeCache.del(cacheMap.key);\n\t\t\t\n\t\t\tif (this._operationInProgress.has(cacheMap.key)) {\n\t\t\t\tthis._operationInProgress.get(cacheMap.key).invalidatedDuringExecution = true;\n\n\t\t\t\tif (ResolveIOServer.getMainServer().getSubscriptionManager() && ResolveIOServer.getMainServer().getSubscriptionManager().getEnableDebug()) {\n\t\t\t\t\tconsole.log(new Date(), 'Mongo Invalidated During Execution', cacheMap.collections);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\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 err => {\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 async create<T>(options: MongoManagerCollectionOptions): Promise<MongoManagerModel<T>> {\n\t\tconst mongoManagerModel = new MongoManagerModel<T>();\n\t\tawait mongoManagerModel.initialize(options);\n\t\treturn mongoManagerModel;\n\t}\n\n\tprivate async 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\tawait this.collection_version.createIndex({'_id._id': 1, '_id.__v': 1});\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\tprivate initialize(options: MongoManagerCollectionOptions) {\n\t\tthis.collectionName = options.collectionName;\n\t\tthis.simplschema = new SimpleSchema(options.schema);\n\t\tthis.timestamps = options.timestamps;\n\t\tthis.createLogs = options.createLogs;\n\t\tthis.checkSchema = options.checkSchema;\n\t\tthis.collectionOptions = options.collectionOptions;\n\t\tthis.skipCache = options.skipCache || false;\n\t\tthis.bypassSession = options.bypassSession || false;\n\n\t\tif (options.useReportBuilder) {\n\t\t\tthis.useRB = true;\n\t\t\tlet schemaCopy = deepCopy(options.schema);\n\t\t\tlet rbSchema = buildRbLookups(options.reportBuilderLookupTables, schemaCopy, []);\n\t\t\tthis.rbSchema = buildRbSchema(rbSchema);\n\t\t}\n\n\t\tlet interval = setInterval(async () => {\n\t\t\tif (ResolveIOServer && ResolveIOServer.getMainServer() && ResolveIOServer.getMongoManager() && ResolveIOServer.getMongoManager().getServerCollections().length) {\n\t\t\t\tawait ResolveIOServer.getMongoManager().registerCollection(this);\n\t\t\t\tclearInterval(interval);\n\t\t\t}\n\t\t}, 1);\n\t}\n\n\tprivate static indexQueue = async.queue(async (task, callback) => {\n\t\tconst { action, collection, specs, options } = task;\n\t\tconst dbCollection = ResolveIOServer.getMainDB().collection(collection.collectionName, collection.collectionOptions);\n\t\n\t\tif (!dbCollection) {\n\t\t\treturn callback(new Error(`Collection ${collection.collectionName} not found`));\n\t\t}\n\t\n\t\ttry {\n\t\t\t// Try creating the index, will auto-skip if already checked in createIndex/createIndexes\n\t\t\tconst result = await dbCollection[action](...specs, options);\n\t\t\tcallback(null, result);\n\t\t} catch (err) {\n\t\t\t// Handle any specific errors related to index creation\n\t\t\tif (err.code === 85 || err.message.includes('IndexOptionsConflict')) {\n\t\t\t\ttry {\n\t\t\t\t\tconst existingIndexName = collection.extractIndexNameFromError(err.message);\n\t\t\t\t\tif (existingIndexName) {\n\t\t\t\t\t\tawait dbCollection.dropIndex(existingIndexName);\n\t\t\t\t\t\tconst result = await dbCollection[action](...specs, options);\n\t\t\t\t\t\tcallback(null, result);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t} catch (innerError) {\n\t\t\t\t\tcallback(innerError);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcallback(err);\n\t\t}\n\t}, 1);\n\n\t// Method to extract index name from error message\n\textractIndexNameFromError(errorMessage) {\n\t\tlet regexPattern = /Index already exists with a different name: (\\S+)/;\n\t\tlet matches = errorMessage.match(regexPattern);\n\t\n\t\tif (!matches || matches.length <= 1) {\n\t\t\t// If the first pattern doesn't match, try the second pattern\n\t\t\tregexPattern = /existing index:.*name: \"([^\"]+)\"/;\n\t\t\tmatches = errorMessage.match(regexPattern);\n\t\t}\n\t\n\t\treturn matches && matches.length > 1 ? matches[1] : null;\n\t}\n\n\tasync aggregate(pipeline: object[], options?: AggregateOptions, skipCache = false, bypassSession = false) : Promise<any[]> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (!skipCache && !this.skipCache) {\n\t\t\treturn ResolveIOServer.getMongoManager().aggregate(this.collectionName, pipeline, options);\n\t\t}\n\t\telse {\n\t\t\tlet { session, ...safeOptions } = options || {};\n\t\t\tlet monitor = MonitorMongo.create('aggregate', this.collectionName, JSON.stringify([pipeline, safeOptions]));\n\n\t\t\ttry {\n\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).aggregate(pipeline, options).toArray();\n\t\t\t\treturn res;\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tconsole.log(new Date(), 'Error Aggregate', this.collectionName, JSON.stringify([pipeline, safeOptions, err], null, 2));\n\t\t\t\terr.message = `Error in Aggregate: ${this.collectionName} - ${err.message}`;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tawait monitor.finish();\n\t\t\t}\n\t\t}\n\t}\n\n\tasync aggregateCount(pipeline: object[], options?: AggregateOptions, bypassSession = false) : Promise<number> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\t\tlet monitor = MonitorMongo.create('aggregateCount', this.collectionName, JSON.stringify([pipeline, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).aggregate(pipeline, options).toArray();\n\t\t\treturn res.length;\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Aggregate Count', this.collectionName, JSON.stringify([pipeline, safeOptions, err], null, 2));\n\t\t\terr.message = `Error in Aggregate Count: ${this.collectionName} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\taggregateCursor(pipeline: object[], options?: AggregateOptions, bypassSession = false): AggregationCursor {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\t\tlet monitor = MonitorMongo.create('aggregateCursor', this.collectionName, JSON.stringify([pipeline, safeOptions]));\n\t\tlet cursor = ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).aggregate(pipeline, options);\n\t\tcursor.on('close', async ev => {\n\t\t\tawait monitor.finish();\n\t\t\treturn ev;\n\t\t});\n\n\t\treturn cursor;\n\t}\n\n\taggregateStream(pipeline: object[], options?: AggregateOptions, streamOptions?: CursorStreamOptions, bypassSession = false) {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\t\tlet monitor = MonitorMongo.create('aggregateStream', this.collectionName, JSON.stringify([pipeline, safeOptions, streamOptions]));\n\t\tlet stream = ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).aggregate(pipeline, options).stream(streamOptions).on('close', async ev => {\n\t\t\tawait monitor.finish();\n\t\t\treturn ev;\n\t\t});\n\n\t\treturn stream;\n\t}\n\n\tasync bulkWrite(\n\t\toperations: any[],\n\t\toptions?: BulkWriteOptions,\n\t\tbypassCheckSchema = false,\n\t\tbypassLogs = false,\n\t\tbypassVersions = false, \n\t\tbypassSession = false\n\t): Promise<BulkWriteResult> {\n\t\tif (!operations.length) {\n\t\t\treturn null;\n\t\t}\n\t\n\t\tconst BATCH_SIZE = 1000;\n\t\tlet opIndex = 0;\n\n\t\tlet sessionOptions = null;\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\t\n\t\twhile (opIndex < operations.length) {\n\t\t\tconst batchOps = operations.slice(opIndex, opIndex + BATCH_SIZE);\n\t\n\t\t\t// Initialize arrays for logs and version operations\n\t\t\tconst logs = [];\n\t\t\tconst versionOps = [];\n\t\n\t\t\tfor (const op of batchOps) {\n\t\t\t\tconst opType = Object.keys(op)[0];\n\t\t\t\tconst doc = op[opType];\n\t\n\t\t\t\t// Skip validation if bypassCheckSchema is true\n\t\t\t\tif (this.checkSchema && !bypassCheckSchema) {\n\t\t\t\t\tconst validationContext = this.simplschema.newContext();\n\t\t\t\t\tlet isValid: boolean;\n\t\n\t\t\t\t\tif (opType === 'insertOne') {\n\t\t\t\t\t\tisValid = validationContext.validate(doc.document);\n\t\t\t\t\t}\n\t\t\t\t\telse if (opType === 'replaceOne') {\n\t\t\t\t\t\tisValid = validationContext.validate(doc.replacement);\n\t\t\t\t\t}\n\t\t\t\t\telse if (opType === 'updateOne' || opType === 'updateMany') {\n\t\t\t\t\t\t// For updates, validate the update modifier\n\t\t\t\t\t\tisValid = validationContext.validate(doc.update, { modifier: true });\n\t\t\t\t\t}\n\t\t\t\t\telse if (opType === 'deleteOne' || opType === 'deleteMany') {\n\t\t\t\t\t\t// No validation needed for deletes\n\t\t\t\t\t\tisValid = true;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tthrow new Error(`Unsupported operation type: ${opType}`);\n\t\t\t\t\t}\n\t\n\t\t\t\t\tif (!isValid) {\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t`Schema validation failed for ${opType}: ${JSON.stringify(validationContext.validationErrors())}`\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\t// Now proceed to process the operations\n\t\n\t\t\t\tif (opType === 'insertOne') {\n\t\t\t\t\t// If this.timestamps is true, set createdAt and updatedAt\n\t\t\t\t\tif (this.timestamps) {\n\t\t\t\t\t\tif (!doc.document.createdAt) {\n\t\t\t\t\t\t\tdoc.document.createdAt = new Date();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (!doc.document.updatedAt) {\n\t\t\t\t\t\t\tdoc.document.updatedAt = new Date();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Prepare log entry\n\t\t\t\t\tif (!bypassLogs && this.createLogs) {\n\t\t\t\t\t\tlogs.push({\n\t\t\t\t\t\t\tinsertOne: {\n\t\t\t\t\t\t\t\tdocument: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: doc.document._id || objectIdHexString(),\n\t\t\t\t\t\t\t\t\tpayload:\n\t\t\t\t\t\t\t\t\t\tgetBinarySize(JSON.stringify(doc.document)) < 200000\n\t\t\t\t\t\t\t\t\t\t\t? JSON.stringify(doc.document, null, 2)\n\t\t\t\t\t\t\t\t\t\t\t: 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: 'insertOne',\n\t\t\t\t\t\t\t\t\tid_user: '', // Add user info if available\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date(),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Prepare version document\n\t\t\t\t\tif (!bypassVersions && this.useVersions) {\n\t\t\t\t\t\tconst versionDoc = {\n\t\t\t\t\t\t\t...doc.document,\n\t\t\t\t\t\t\t__v: 0,\n\t\t\t\t\t\t\t_id: { _id: doc.document._id || objectIdHexString(), __v: 0 },\n\t\t\t\t\t\t};\n\t\t\t\t\t\tversionOps.push({\n\t\t\t\t\t\t\tinsertOne: {\n\t\t\t\t\t\t\t\tdocument: versionDoc\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Since we might have modified doc.document, update the operation\n\t\t\t\t\top[opType].document = doc.document;\n\t\t\t\t}\n\t\t\t\telse if (opType === 'updateOne' || opType === 'updateMany') {\n\t\t\t\t\t// If this.timestamps is true, add updatedAt\n\t\t\t\t\tif (this.timestamps) {\n\t\t\t\t\t\tif (!doc.update.$set) {\n\t\t\t\t\t\t\tdoc.update.$set = {};\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdoc.update.$set.updatedAt = new Date();\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// If this.useVersions is true, increment __v\n\t\t\t\t\tif (!bypassVersions && this.useVersions) {\n\t\t\t\t\t\tif (!doc.update.$inc) {\n\t\t\t\t\t\t\tdoc.update.$inc = {};\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdoc.update.$inc.__v = 1;\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Prepare log entry\n\t\t\t\t\tif (!bypassLogs && this.createLogs) {\n\t\t\t\t\t\tlogs.push({\n\t\t\t\t\t\t\tinsertOne: {\n\t\t\t\t\t\t\t\tdocument: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: doc.filter._id || null,\n\t\t\t\t\t\t\t\t\tpayload:\n\t\t\t\t\t\t\t\t\t\tgetBinarySize(JSON.stringify(doc.update)) < 200000\n\t\t\t\t\t\t\t\t\t\t\t? JSON.stringify(doc.update, null, 2)\n\t\t\t\t\t\t\t\t\t\t\t: 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: opType,\n\t\t\t\t\t\t\t\t\tid_user: '', // Add user info if available\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date(),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// For versioning, store the filter to fetch the document later\n\t\t\t\t\tif (!bypassVersions && this.useVersions) {\n\t\t\t\t\t\tversionOps.push({\n\t\t\t\t\t\t\tfilter: doc.filter,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// No need to modify the operation further\n\t\t\t\t}\n\t\t\t\telse if (opType === 'replaceOne') {\n\t\t\t\t\t// If this.timestamps is true, set updatedAt\n\t\t\t\t\tif (this.timestamps) {\n\t\t\t\t\t\tdoc.replacement.updatedAt = new Date();\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// If this.useVersions is true, increment __v\n\t\t\t\t\tif (!bypassVersions && this.useVersions) {\n\t\t\t\t\t\tdoc.replacement.__v = (doc.replacement.__v || 0) + 1;\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Prepare log entry\n\t\t\t\t\tif (!bypassLogs && this.createLogs) {\n\t\t\t\t\t\tlogs.push({\n\t\t\t\t\t\t\tinsertOne: {\n\t\t\t\t\t\t\t\tdocument: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: doc.filter._id || null,\n\t\t\t\t\t\t\t\t\tpayload:\n\t\t\t\t\t\t\t\t\t\tgetBinarySize(JSON.stringify(doc.replacement)) < 200000\n\t\t\t\t\t\t\t\t\t\t\t? JSON.stringify(doc.replacement, null, 2)\n\t\t\t\t\t\t\t\t\t\t\t: 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\t\t\tid_user: '', // Add user info if available\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date(),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// For versioning, store the filter to fetch the document later\n\t\t\t\t\tif (!bypassVersions && this.useVersions) {\n\t\t\t\t\t\tversionOps.push({\n\t\t\t\t\t\t\tfilter: doc.filter,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Since we might have modified doc.replacement, update the operation\n\t\t\t\t\top[opType].replacement = doc.replacement;\n\t\t\t\t}\n\t\t\t\telse if (opType === 'deleteOne' || opType === 'deleteMany') {\n\t\t\t\t\t// Prepare log entry\n\t\t\t\t\tif (!bypassLogs && this.createLogs) {\n\t\t\t\t\t\tlogs.push({\n\t\t\t\t\t\t\tinsertOne: {\n\t\t\t\t\t\t\t\tdocument: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: doc.filter._id || null,\n\t\t\t\t\t\t\t\t\tpayload:\n\t\t\t\t\t\t\t\t\t\tgetBinarySize(JSON.stringify(doc.filter)) < 200000\n\t\t\t\t\t\t\t\t\t\t\t? JSON.stringify(doc.filter, null, 2)\n\t\t\t\t\t\t\t\t\t\t\t: 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: opType,\n\t\t\t\t\t\t\t\t\tid_user: '', // Add user info if available\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date(),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// For versioning, store the filter to fetch the document later\n\t\t\t\t\tif (!bypassVersions && this.useVersions) {\n\t\t\t\t\t\tversionOps.push({\n\t\t\t\t\t\t\tfilter: doc.filter,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// No need to modify the operation\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthrow new Error(`Unsupported operation type: ${opType}`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet affectedDocs = [];\n\t\n\t\t\t// Handle versioning\n\t\t\tif (!bypassVersions && this.useVersions && versionOps.length > 0) {\n\t\t\t\ttry {\n\t\t\t\t\t// Fetch the affected documents\n\t\t\t\t\tconst versionFilters = versionOps.map((v) => v.filter);\n\t\t\t\t\taffectedDocs = await ResolveIOServer.getMainDB().collection(this.collectionName).find({ $or: versionFilters }, sessionOptions).toArray();\n\t\t\n\t\t\t\t\t// Prepare version documents\n\t\t\t\t\tconst versionInserts = affectedDocs.map((doc) => ({\n\t\t\t\t\t\tinsertOne: {\n\t\t\t\t\t\t\tdocument: {\n\t\t\t\t\t\t\t\t...doc,\n\t\t\t\t\t\t\t\t_id: { _id: doc._id, __v: doc.__v },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t}));\n\t\t\n\t\t\t\t\t// Insert versions in bulk\n\t\t\t\t\tif (versionInserts.length > 0) {\n\t\t\t\t\t\tlet bwOptions = null;\n\t\t\t\t\t\tif (!sessionOptions) {\n\t\t\t\t\t\t\tbwOptions = {ordered: false};\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tbwOptions = {session: mongoSession, ordered: false};\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection(this.versionCollection).bulkWrite(<any>versionInserts, bwOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch(e) {\n\t\t\t\t\tconsole.error('Error during version creation:', e);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet { session, ...safeOptions } = options || {};\n\n\t\t\t// Execute bulkWrite\n\t\t\tconst monitor = MonitorMongo.create('bulkWrite', this.collectionName, JSON.stringify([batchOps, safeOptions]));\n\n\t\t\ttry {\n\t\t\t\tawait ResolveIOServer.getMainDB().collection(this.collectionName).bulkWrite(batchOps, options);\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\terr.message = `Error in Bulk Write: ${this.collectionName} - ${err.message}`;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tawait monitor.finish();\n\t\t\t}\n\t\n\t\t\t// Insert logs in bulk\n\t\t\tif (!bypassLogs && this.createLogs && logs.length > 0) {\n\t\t\t\tif (\n\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t) {\n\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLogs(logs.map(a => {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\tdata: a\n\t\t\t\t\t\t};\n\t\t\t\t\t}));\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tlet bwOptions = null;\n\t\t\t\t\tif (!sessionOptions) {\n\t\t\t\t\t\tbwOptions = {ordered: false};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tbwOptions = {session: mongoSession, ordered: false};\n\t\t\t\t\t}\n\n\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').bulkWrite(logs, bwOptions);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!bypassVersions && this.useVersions) {\n\t\t\t\t// Delete old versions beyond the latest 5\n\t\t\t\ttry {\n\t\t\t\t\tconst affectedDocIds = affectedDocs.map((doc) => doc._id);\n\t\n\t\t\t\t\tconst pipeline = [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$match: { '_id._id': { $in: affectedDocIds } },\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$sort: { '_id._id': 1, '_id.__v': -1 },\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$group: {\n\t\t\t\t\t\t\t\t_id: '$_id._id',\n\t\t\t\t\t\t\t\tversions: { $push: '$_id' },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$project: {\n\t\t\t\t\t\t\t\tversionsToDelete: { $slice: ['$versions', 5, { $size: '$versions' }] },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{ $unwind: '$versionsToDelete' },\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$replaceRoot: { newRoot: { _id: '$versionsToDelete' } },\n\t\t\t\t\t\t},\n\t\t\t\t\t];\n\t\n\t\t\t\t\tconst oldVersions = await ResolveIOServer.getMainDB().collection(this.versionCollection).aggregate(pipeline, sessionOptions).toArray();\n\t\n\t\t\t\t\tif (oldVersions.length > 0) {\n\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection(this.versionCollection).deleteMany({ _id: { $in: oldVersions.map((v) => v._id) } }, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch (error) {\n\t\t\t\t\tconsole.error('Error during version cleanup:', error);\n\t\t\t\t\t// Handle the error as needed\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\topIndex += BATCH_SIZE;\n\t\n\t\t\t// Yield to the event loop\n\t\t\t// eslint-disable-next-line no-restricted-syntax\n\t\t\tawait new Promise((resolve) => setImmediate(resolve));\n\t\n\t\t\t// Invalidate cache\n\t\t\tif (!this.skipCache) {\n\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t}\n\t\t}\n\t\n\t\treturn { ok: 1 } as BulkWriteResult; // Adjust return value as per your requirements\n\t}\n\n\tasync countDocuments(\n\t\tfilter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {},\n\t\toptions?: CountDocumentsOptions,\n\t\tskipCache = false, \n\t\tbypassSession = false\n\t): Promise<number> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\t\t\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\t// Check if the filter is empty\n\t\tconst isUnfiltered = Object.keys(filter).length === 0;\n\n\t\tif (isUnfiltered) {\n\t\t\t// Use collection stats for an unfiltered count\n\t\t\treturn ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).estimatedDocumentCount(options);\n\t\t}\n\t\telse if (!skipCache && !this.skipCache) {\n\t\t\t// Use cached count if skipCache is false\n\t\t\treturn ResolveIOServer.getMongoManager().countDocuments(this.collectionName, filter, options);\n\t\t}\n\t\telse {\n\t\t\t// Fallback to direct countDocuments call with monitoring if skipCache is true\n\n\t\t\tlet monitor = MonitorMongo.create('countDocuments', this.collectionName, JSON.stringify([filter, safeOptions]));\n\n\t\t\ttry {\n\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).countDocuments(<any>filter, options);\n\t\t\t\treturn res;\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tconsole.log(new Date(), 'Error Count Documents', this.collectionName, filter, safeOptions, err);\n\t\t\t\terr.message = `Error in Count Documents: ${this.collectionName} - ${err.message}`;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tawait monitor.finish();\n\t\t\t}\n\t\t}\n\t}\n\n\t//Helper Function (1 or Many) - Not Real Mongo Function\n\tcreate(f_docs: T | T[], options?: InsertOneOptions | BulkWriteOptions): Promise<T | T[]> {\n\t\tif (!Array.isArray(f_docs)) {\n\t\t\treturn this.insertOne(f_docs, <InsertOneOptions>options);\n\t\t}\n\t\telse if (f_docs.length === 1) {\n\t\t\treturn this.insertOne(f_docs[0], <InsertOneOptions>options);\n\t\t}\n\n\t\treturn this.insertMany(f_docs, <BulkWriteOptions>options);\n\t}\n\n\tasync createIndex(fieldOrSpec: any, options?: CreateIndexesOptions): Promise<string> {\n\t\ttry {\n\t\t\t// Check if index already exists based on the key\n\t\t\tconst dbCollection = ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions);\n\t\t\tconst existingIndexes = await dbCollection.indexes();\n\n\t\t\t// Check if an index with the same key already exists\n\t\t\tconst indexExists = existingIndexes.some(index => \n\t\t\t\tJSON.stringify(index.key) === JSON.stringify(fieldOrSpec)\n\t\t\t);\n\n\t\t\tif (indexExists) {\n\t\t\t\treturn 'Index already exists'; // Skip creation if index exists\n\t\t\t}\n\n\t\t\t// If index doesn't exist, push it to the queue\n\t\t\tMongoManagerCollection.indexQueue.push({\n\t\t\t\taction: 'createIndex',\n\t\t\t\tcollection: this,\n\t\t\t\tspecs: [fieldOrSpec],\n\t\t\t\toptions: options\n\t\t\t}, (error, result) => {\n\t\t\t\tif (error) throw error;\n\t\t\t\telse return result;\n\t\t\t});\n\n\t\t\treturn 'Index creation queued';\n\t\t} \n\t\tcatch (err) {\n\t\t\tthrow err;\n\t\t}\n\t}\n\t\n\tasync createIndexes(indexSpecs: IndexDescription[], options?: CreateIndexesOptions): Promise<string[]> {\n\t\ttry {\n\t\t\tconst dbCollection = ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions);\n\t\t\tconst existingIndexes = await dbCollection.indexes();\n\n\t\t\t// Filter out indexes that already exist based on the key\n\t\t\tconst indexesToCreate = indexSpecs.filter(indexSpec => \n\t\t\t\t!existingIndexes.some(existingIndex => \n\t\t\t\t\tJSON.stringify(existingIndex.key) === JSON.stringify(indexSpec.key)\n\t\t\t\t)\n\t\t\t);\n\n\t\t\t// If no new indexes to create, resolve early\n\t\t\tif (indexesToCreate.length === 0) {\n\t\t\t\treturn ['All indexes already exist'];\n\t\t\t}\n\n\t\t\t// Push only new indexes to the queue\n\t\t\tMongoManagerCollection.indexQueue.push({\n\t\t\t\taction: 'createIndexes',\n\t\t\t\tcollection: this,\n\t\t\t\tspecs: [indexesToCreate],\n\t\t\t\toptions: options\n\t\t\t}, (error, result) => {\n\t\t\t\tif (error) throw error;\n\t\t\t\telse return result;\n\t\t\t});\n\n\t\t\treturn ['Index creation queued'];\n\t\t} \n\t\tcatch (err) {\n\t\t\tthrow err;\n\t\t}\n\t}\n\t\n\tasync deleteMany(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {}, options?: DeleteOptions, bypassLogs = false, bypassSession = false): Promise<number> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\t\t\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tif ((this.createLogs && !bypassLogs) || this.useVersions) {\n\t\t\tlet docs = await this.find(filter);\n\n\t\t\tfor (let i = 0; i < docs.length; i++) {\n\t\t\t\tlet doc = docs[i];\n\t\t\t\n\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t) {\n\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, safeOptions])) < 200000 ? JSON.stringify([doc, filter, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'deleteMany',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, safeOptions])) < 200000 ? JSON.stringify([doc, filter, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\tmethod: 'deleteMany',\n\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.useVersions) {\n\t\t\t\t\tlet versionDoc = deepCopy(doc);\n\t\t\t\t\tversionDoc._id = {_id: doc._id, __v: doc.__v};\n\n\t\t\t\t\tlet versionOptions = null;\n\t\t\t\t\tif (!sessionOptions) {\n\t\t\t\t\t\tversionOptions = {upsert: true};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tversionOptions = {session: mongoSession, upsert: true};\n\t\t\t\t\t}\n\n\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, versionOptions);\n\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).deleteMany(<any>{$and: [{'_id._id': doc._id}, {'_id.__v': {$lt: doc.__v - 1}}]}, sessionOptions);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tlet monitor = MonitorMongo.create('deleteMany', this.collectionName, JSON.stringify([filter, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).deleteMany(<any>filter, options);\n\t\t\tif (res.acknowledged) {\n\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t}\n\t\t\t\treturn res.deletedCount;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new Error(`Error in DeleteMany: ${this.collectionName}`);\n\t\t\t}\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Delete Many', this.collectionName, filter, safeOptions, err);\n\t\t\terr.message = `Error in Delete Many: ${this.collectionName} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync deleteOne(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {}, options?: FindOneAndDeleteOptions, bypassLogs = false, bypassSession = false): Promise<number> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tif (this.createLogs && !bypassLogs) {\n\t\t\tlet monitor = MonitorMongo.create('findOneAndDelete', this.collectionName, JSON.stringify([filter, safeOptions]));\n\t\t\t\n\t\t\ttry {\n\t\t\t\tlet returnVal = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).findOneAndDelete(<any>filter, options);\n\t\t\t\tlet doc = returnVal.value;\n\n\t\t\t\tif (doc) {\n\t\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: doc._id as string,\n\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, safeOptions])) < 200000 ? JSON.stringify([doc, filter, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: 'deleteOne',\n\t\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: doc._id as string,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, safeOptions])) < 200000 ? JSON.stringify([doc, filter, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'deleteOne',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (this.useVersions) {\n\t\t\t\t\t\tlet versionDoc = deepCopy(doc);\n\t\t\t\t\t\tversionDoc._id = {_id: doc._id, __v: doc.__v};\n\n\t\t\t\t\t\tlet versionOptions = null;\n\t\t\t\t\t\tif (!sessionOptions) {\n\t\t\t\t\t\t\tversionOptions = {upsert: true};\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tversionOptions = {session, upsert: true};\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, versionOptions);\n\t\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).deleteMany(<any>{$and: [{'_id._id': doc._id}, {'_id.__v': {$lt: doc.__v - 1}}]}, sessionOptions);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tconsole.log(new Date(), 'Error Delete One (Find One And Delete)', this.collectionName, filter, safeOptions, err);\n\t\t\t\terr.message = `Error in Delete One (Find One And Delete): ${this.collectionName} - ${err.message}`;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tawait monitor.finish();\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tlet monitor = MonitorMongo.create('deleteOne', this.collectionName, JSON.stringify([filter, safeOptions]));\n\n\t\t\ttry {\n\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).deleteOne(<any>filter, options);\n\t\t\t\tif (res.acknowledged) {\n\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t}\n\t\t\t\t\treturn res.deletedCount;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthrow new Error(`Error in Delete One: ${this.collectionName}`);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tconsole.log(new Date(), 'Error Delete One', this.collectionName, filter, safeOptions, err);\n\t\t\t\terr.message = `Error in Delete One: ${this.collectionName} - ${err.message}`;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tawait monitor.finish();\n\t\t\t}\n\t\t}\n\t}\n\n\tasync distinct(key: string, filter?: MongoManagerFilter<T> & MongoManagerFilterOperators<T>, options?: CommandOperationOptions, bypassSession = false): Promise<T[]> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('distinct', this.collectionName, JSON.stringify([key, filter, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).distinct(key, <any>filter, options);\n\t\t\treturn res;\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Distinct', this.collectionName, filter, safeOptions, err);\n\t\t\terr.message = `Error in Distinct: ${this.collectionName} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync drop(options?: CommandOperationOptions, bypassSession = false): Promise<boolean> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('drop', this.collectionName, JSON.stringify([safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).drop(options);\n\t\t\treturn res;\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Count Documents', this.collectionName, safeOptions, err);\n\t\t\terr.message = `Error in Count Documents: ${this.collectionName} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync dropIndex(indexName: string, options?: CommandOperationOptions, bypassSession = false): Promise<Document> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('dropIndex', this.collectionName, JSON.stringify([indexName, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).dropIndex(indexName, options);\n\t\t\treturn <Document>res;\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Drop Index', this.collectionName, indexName, safeOptions, err);\n\t\t\terr.message = `Error in Drop Index: ${this.collectionName} - ${indexName} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync dropIndexes(options?: CommandOperationOptions, bypassSession = false): Promise<Document> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('dropIndexes', this.collectionName, JSON.stringify([safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).dropIndexes(options);\n\t\t\treturn res;\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Drop Indexes', this.collectionName, safeOptions, err);\n\t\t\terr.message = `Error in Drop Indexes: ${this.collectionName} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync find(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {}, options?: FindOptions<T>, skipCache = false, bypassSession = false): Promise<T[]> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tif (!skipCache && !this.skipCache) {\n\t\t\treturn ResolveIOServer.getMongoManager().find(this.collectionName, filter, options);\n\t\t}\n\t\telse {\n\t\t\tlet monitor = MonitorMongo.create('find', this.collectionName, JSON.stringify([filter, safeOptions]));\n\n\t\t\ttry {\n\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).find<T>(<any>filter, options).toArray();\n\t\t\t\treturn res;\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tconsole.log(new Date(), 'Error Find', this.collectionName, filter, safeOptions, err);\n\t\t\t\terr.message = `Error in Find: ${this.collectionName} - ${JSON.stringify(filter, null, 2)} - ${err.message}`;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tawait monitor.finish();\n\t\t\t}\n\t\t}\n\t}\n\n\tasync findById(id: string, options?: FindOptions<T>, skipCache = false, bypassSession = false): Promise<T> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tif (!skipCache && !this.skipCache) {\n\t\t\treturn ResolveIOServer.getMongoManager().findOne(this.collectionName, {_id: id}, options);\n\t\t}\n\t\telse {\n\t\t\tlet monitor = MonitorMongo.create('findById', this.collectionName, JSON.stringify([{_id: id}, safeOptions]));\n\t\t\t\n\t\t\ttry {\n\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).findOne<T>(<any>{_id: id}, options);\n\t\t\t\treturn res;\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tconsole.log(new Date(), 'Error Find By Id', this.collectionName, {_id: id}, safeOptions, err);\n\t\t\t\terr.message = `Error in Find By ID: ${this.collectionName} - ${id} - ${err.message}`;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tawait monitor.finish();\n\t\t\t}\n\t\t}\n\t}\n\n\tasync findCount(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {}, options?: FindOptions<T>, bypassSession = false): Promise<Number> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('findCount', this.collectionName, JSON.stringify([filter, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).find(<any>filter, options).count();\n\t\t\treturn res;\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Find Count', this.collectionName, filter, safeOptions, err);\n\t\t\terr.message = `Error in Find Count: ${this.collectionName} - ${JSON.stringify(filter, null, 2)} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tfindCursor(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {}, options?: FindOptions<T>, bypassSession = false): FindCursor {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\t\t\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('findCursor', this.collectionName, JSON.stringify([filter, safeOptions]));\n\t\tlet cursor = ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).find(<any>filter, options);\n\t\tcursor.on('close', async ev => {\n\t\t\tawait monitor.finish();\n\t\t\tcursor.removeAllListeners();\n\t\t\treturn ev;\n\t\t});\n\n\t\treturn cursor;\n\t}\n\n\tfindStream(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {}, options?: FindOptions<T>, streamOptions?: CursorStreamOptions, bypassSession = false) {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\t\t\n\t\tlet { session, ...safeOptions } = options || {};\n\t\t\n\t\tlet monitor = MonitorMongo.create('findStream', this.collectionName, JSON.stringify([filter, safeOptions, streamOptions]));\n\t\tlet stream = ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).find(<any>filter, options).stream(streamOptions).on('close', async ev => {\n\t\t\tawait monitor.finish();\n\t\t\treturn ev;\n\t\t});\n\n\t\treturn stream;\n\t}\n\n\tasync findOne(filter: MongoManagerFilter<T> | MongoManagerFilterOperators<T> = {}, options?: FindOptions<T>, skipCache = false, bypassSession = false): Promise<T> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\tif (!skipCache && !this.skipCache) {\n\t\t\treturn ResolveIOServer.getMongoManager().findOne(this.collectionName, filter, options);\n\t\t}\n\t\telse {\n\t\t\tlet { session, ...safeOptions } = options || {};\n\n\t\t\tlet monitor = MonitorMongo.create('findOne', this.collectionName, JSON.stringify([filter, safeOptions]));\n\t\t\t\n\t\t\ttry {\n\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).findOne<T>(<any>filter, options);\n\t\t\t\treturn res;\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tconsole.log(new Date(), 'Error Find One', this.collectionName, filter, safeOptions, err);\n\t\t\t\terr.message = `Error in Find One: ${this.collectionName} - ${JSON.stringify(filter, null, 2)} - ${err.message}`;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tawait monitor.finish();\n\t\t\t}\n\t\t}\n\t}\n\n\tasync findOneAndDelete(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {}, options?: FindOneAndDeleteOptions, bypassLogs = false, bypassSession = false): Promise<T> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('findOneAndDelete', this.collectionName, JSON.stringify([filter, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).findOneAndDelete(<any>filter, options);\n\t\t\tlet doc = res.value;\n\t\t\t\n\t\t\tif (doc) {\n\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t) {\n\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: doc._id as string,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, safeOptions])) < 200000 ? JSON.stringify([doc, filter, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'findOneAndDelete',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\tid_document: doc._id as string,\n\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, safeOptions])) < 200000 ? JSON.stringify([doc, filter, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\tmethod: 'findOneAndDelete',\n\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.useVersions) {\n\t\t\t\t\tlet versionDoc = deepCopy(doc);\n\t\t\t\t\tversionDoc._id = {_id: doc._id, __v: doc.__v};\n\n\t\t\t\t\tlet versionOptions = null;\n\t\t\t\t\tif (!sessionOptions) {\n\t\t\t\t\t\tversionOptions = {upsert: true};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tversionOptions = {session, upsert: true};\n\t\t\t\t\t}\n\n\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, versionOptions);\n\t\t\t\t}\n\n\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t}\n\n\t\t\t\treturn <T>doc;\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Find One And Delete', this.collectionName, filter, safeOptions, err);\n\t\t\terr.message = `Error in Find One And Delete: ${this.collectionName} - ${JSON.stringify(filter, null, 2)} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync findOneAndReplace(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {}, replacement: T, options?: FindOneAndReplaceOptions, bypassLogs = false, bypassCheckSchema = false, bypassSession = false): Promise<T> {\n\t\tif (this.checkSchema && !bypassCheckSchema) {\n\t\t\tconst validation = this.simplschema.newContext();\n\t\t\tconst isValid = validation.validate(replacement);\n\n\t\t\tif (!isValid) {\n\t\t\t\tconsole.log(new Date(), this.collectionName, 'Schema Errors - findOneAndReplace', validation.validationErrors());\n\t\t\t\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on findOneAndReplace - ' + this.collectionName, [validation.validationErrors(), replacement]);\n\t\t\t\t\n\t\t\t\tthrow validation.validationErrors();\n\t\t\t}\n\t\t}\n\t\t\n\t\tlet date = new Date();\n\n\t\tif (this.timestamps) {\n\t\t\treplacement.updatedAt = date;\n\t\t}\n\n\t\tif (options && options.upsert) {\n\t\t\tif (!replacement._id) {\n\t\t\t\treplacement._id = objectIdHexString();\n\t\t\t}\n\n\t\t\tif (this.useVersions) {\n\t\t\t\treplacement.__v = 0;\n\t\t\t}\n\n\t\t\tif (this.timestamps && !replacement.createdAt) {\n\t\t\t\treplacement.createdAt = date;\n\t\t\t}\n\t\t}\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('findOneAndReplace', this.collectionName, JSON.stringify([filter, replacement, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).findOneAndReplace(<any>filter, replacement, options);\n\t\t\tlet doc = res.value;\n\n\t\t\tif (doc) {\n\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t) {\n\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: doc._id as string,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, replacement, safeOptions])) < 200000 ? JSON.stringify([doc, filter, replacement, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'findOneAndReplace',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\tid_document: doc._id as string,\n\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, replacement, safeOptions])) < 200000 ? JSON.stringify([doc, filter, replacement, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\tmethod: 'findOneAndReplace',\n\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.useVersions) {\n\t\t\t\t\tlet versionDoc = deepCopy(doc);\n\t\t\t\t\tversionDoc._id = {_id: doc._id, __v: doc.__v};\n\n\t\t\t\t\tlet versionOptions = null;\n\t\t\t\t\tif (!sessionOptions) {\n\t\t\t\t\t\tversionOptions = {upsert: true};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tversionOptions = {session, upsert: true};\n\t\t\t\t\t}\n\n\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, versionOptions);\n\t\t\t\t}\n\n\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t}\n\n\t\t\t\treturn <T>doc;\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Find One And Replace', this.collectionName, filter, safeOptions, err);\n\t\t\terr.message = `Error in Find One And Replace: ${this.collectionName} - ${JSON.stringify(filter, null, 2)} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync findOneAndUpdate(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {}, update: MongoManagerUpdateFilter<T>, options?: FindOneAndUpdateOptions, bypassLogs = false, bypassCheckSchema = false, bypassSession = false): Promise<T> {\n\t\tif (this.checkSchema && !bypassCheckSchema) {\n\t\t\tconst validation = this.simplschema.newContext();\n\t\t\tconst isValid = validation.validate(update, {modifier: true});\n\n\t\t\tif (!isValid) {\n\t\t\t\tconsole.log(new Date(), this.collectionName, 'Schema Errors - findOneAndUpdate', validation.validationErrors());\n\t\t\t\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on findOneAndUpdate - ' + this.collectionName, [validation.validationErrors(), update]);\n\t\t\t\tthrow validation.validationErrors();\n\t\t\t}\n\t\t}\n\n\t\tif (this.timestamps) {\n\t\t\tlet date = new Date(); \n\t\t\t\n\t\t\tif (!update.$set) {\n\t\t\t\tupdate.$set = <any>{updatedAt: date};\n\t\t\t}\n\t\t\telse {\n\t\t\t\tupdate.$set.updatedAt = date;\n\t\t\t}\n\t\t}\n\n\t\tif (options && options.upsert) {\n\t\t\tif (!update.$setOnInsert) {\n\t\t\t\tif (this.timestamps) {\n\t\t\t\t\tupdate.$setOnInsert = <any>{\n\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tupdate.$setOnInsert = <any>{\n\t\t\t\t\t\t_id: objectIdHexString()\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (!update.$setOnInsert._id) {\n\t\t\t\t\tupdate.$setOnInsert._id = objectIdHexString();\n\t\t\t\t}\n\n\t\t\t\tif (this.timestamps && !update.$setOnInsert.createdAt) {\n\t\t\t\t\tupdate.$setOnInsert.createdAt = new Date();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('findOneAndUpdate', this.collectionName, JSON.stringify([filter, update, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).findOneAndUpdate(<any>filter, <any>update, options);\n\t\t\tlet doc = res.value;\n\n\t\t\tif (doc) {\n\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t) {\t\n\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: <string>doc._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, update, safeOptions])) < 200000 ? JSON.stringify([doc, filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'findOneAndUpdate',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\tid_document: <string>doc._id,\n\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, update, safeOptions])) < 200000 ? JSON.stringify([doc, filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\tmethod: 'findOneAndUpdate',\n\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.useVersions) {\n\t\t\t\t\tlet versionDoc = deepCopy(doc);\n\t\t\t\t\tversionDoc._id = {_id: doc._id, __v: doc.__v};\n\n\t\t\t\t\tlet versionOptions = null;\n\t\t\t\t\tif (!sessionOptions) {\n\t\t\t\t\t\tversionOptions = {upsert: true};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tversionOptions = {session, upsert: true};\n\t\t\t\t\t}\n\n\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, versionOptions);\n\t\t\t\t}\n\n\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\treturn <T>doc;\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Find One And Update', this.collectionName, filter, safeOptions, err);\n\t\t\terr.message = `Error in Find One And Update: ${this.collectionName} - ${JSON.stringify(filter, null, 2)} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync indexes(options: IndexInformationOptions, bypassSession = false): Promise<any[]> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('indexes', this.collectionName, JSON.stringify([safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).indexes(options);\n\t\t\treturn res;\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Indexes', this.collectionName, safeOptions, err);\n\t\t\terr.message = `Error in Indexes: ${this.collectionName} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync indexExists(indexes: string | string[], options?: IndexInformationOptions, bypassSession = false): Promise<boolean> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('indexExists', this.collectionName, JSON.stringify([indexes, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).indexExists(indexes, options);\n\t\t\treturn res;\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Index Exists', this.collectionName, indexes, safeOptions, err);\n\t\t\terr.message = `Error in Index Exists: ${this.collectionName} - ${JSON.stringify(indexes, null, 2)} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync insertMany(docs: T[], options?: BulkWriteOptions, bypassLogs = false, bypassCheckSchema = false, bypassMonitor = false, bypassSession = false): Promise<T[]> {\n\t\tif (!docs.length) {\n\t\t\treturn [];\n\t\t}\n\t\t\n\t\tlet validationResults = [];\n\n\t\tif (this.checkSchema && !bypassCheckSchema) {\n\t\t\tdocs.forEach(doc => {\n\t\t\t\tconst validation = this.simplschema.newContext();\n\t\t\t\tconst isValid = validation.validate(doc);\n\n\t\t\t\tif (!isValid) {\n\t\t\t\t\tconsole.log(new Date(), this.collectionName, 'Schema Errors - insertMany', validation.validationErrors());\n\t\t\t\t\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on insertMany - ' + this.collectionName, [validation.validationErrors(), doc]);\n\t\t\t\t\tvalidationResults.push(false);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tvalidationResults.push(true);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tlet validDocs = this.checkSchema ? docs.filter((a, idx) => validationResults[idx]) : docs;\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tfor (let i = 0; i < validDocs.length; i++) {\n\t\t\tlet doc = validDocs[i];\n\n\t\t\tif (!doc._id) {\n\t\t\t\tdoc._id = objectIdHexString();\n\t\t\t}\n\n\t\t\tif (this.timestamps) {\n\t\t\t\tlet date = new Date();\n\n\t\t\t\tif (!doc.createdAt) {\n\t\t\t\t\tdoc.createdAt = date;\n\t\t\t\t}\n\n\t\t\t\tif (!doc.updatedAt) {\n\t\t\t\t\tdoc.updatedAt = date;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.useVersions && !doc.hasOwnProperty('__v')) {\n\t\t\t\tdoc.__v = 0;\n\t\t\t}\n\n\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\tif (\n\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t) {\n\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, safeOptions])) < 200000 ? JSON.stringify([doc, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\tmethod: 'insertMany',\n\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, safeOptions])) < 200000 ? JSON.stringify([doc, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\tmethod: 'insertMany',\n\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\troute: '',\n\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t}, sessionOptions);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (validDocs.length) {\n\t\t\tlet monitor = null;\n\t\t\t\n\t\t\tif (!bypassMonitor) {\n\t\t\t\tmonitor = MonitorMongo.create('insertMany', this.collectionName, JSON.stringify([validDocs, safeOptions]));\n\t\t\t}\n\t\t\t\n\t\t\ttry {\n\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).insertMany(<OptionalUnlessRequiredId<T>[]>validDocs, options);\n\n\t\t\t\tif (res.acknowledged) {\n\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t}\n\t\t\t\t\treturn validDocs;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthrow new Error(`Error in Insert Many: ${this.collectionName} - ${JSON.stringify(res, null, 2)}`);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tconsole.log(new Date(), 'Error Insert Many', this.collectionName, validDocs, safeOptions, err);\n\t\t\t\terr.message = `Error in Insert Many: ${this.collectionName} - ${err.message}`;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tif (monitor) {\n\t\t\t\t\tmonitor.finish();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn [];\n\t}\n\n\tasync insertOne(doc: T, options?: InsertOneOptions, bypassLogs = false, bypassCheckSchema = false, bypassSession = false): Promise<T> {\n\t\tif (!doc._id) {\n\t\t\tdoc._id = objectIdHexString();\n\t\t}\n\n\t\tif (this.checkSchema && !bypassCheckSchema) {\n\t\t\tconst validation = this.simplschema.newContext();\n\t\t\tconst isValid = validation.validate(doc);\n\n\t\t\tif (!isValid) {\n\t\t\t\tconsole.log(new Date(), this.collectionName, 'Schema Errors - insertOne', validation.validationErrors());\n\t\t\t\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on insertOne - ' + this.collectionName, [validation.validationErrors(), doc]);\n\t\t\t\tthrow validation.validationErrors();\n\t\t\t}\n\t\t}\n\n\t\tif (this.timestamps) {\n\t\t\tlet date = new Date();\n\t\t\n\t\t\tif (!doc.createdAt) {\n\t\t\t\tdoc.createdAt = date;\n\t\t\t}\n\n\t\t\tif (!doc.updatedAt) {\n\t\t\t\tdoc.updatedAt = date;\n\t\t\t}\n\t\t}\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tif (this.createLogs && !bypassLogs) {\n\t\t\tif (\n\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t) {\n\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\ttype: 'log',\n\t\t\t\t\tdata: {\n\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, safeOptions])) < 200000 ? JSON.stringify([doc, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\tmethod: 'insertOne',\n\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\troute: '',\n\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\telse {\n\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\ttype: 'document',\n\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, safeOptions])) < 200000 ? JSON.stringify([doc, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\tmethod: 'insertOne',\n\t\t\t\t\tid_user: '',\n\t\t\t\t\tuser: '',\n\t\t\t\t\tmessageId: 0,\n\t\t\t\t\troute: '',\n\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t}, sessionOptions);\n\t\t\t}\n\t\t}\n\n\t\tif (this.useVersions && !doc.hasOwnProperty('__v')) {\n\t\t\tdoc.__v = 0;\n\t\t}\n\n\t\tlet monitor = MonitorMongo.create('insertOne', this.collectionName, JSON.stringify([doc, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).insertOne(<OptionalUnlessRequiredId<T>>doc, options);\n\t\t\tif (res.acknowledged) {\n\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t}\n\t\t\t\treturn doc;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new Error(`Error in Insert One: ${this.collectionName} - ${JSON.stringify(res, null, 2)}`);\n\t\t\t}\n\t\t}\n\t\tcatch(err) {\n\t\t\tconsole.log(new Date(), 'Error Insert One', this.collectionName, doc, safeOptions, err);\n\t\t\terr.message = `Error in Insert One: ${this.collectionName} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tlistIndexes(options?: ListIndexesOptions, bypassSession = false): ListIndexesCursor {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\t\t\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('listIndexes', this.collectionName, JSON.stringify([safeOptions]));\n\t\tlet cursor = ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).listIndexes(options);\n\t\tcursor.on('close', async ev => {\n\t\t\tawait monitor.finish();\n\t\t\treturn ev;\n\t\t});\n\n\t\treturn cursor;\n\t}\n\n\tasync rename(newName: string, options?: RenameOptions, bypassSession = false): Promise<Collection<Document>> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('rename', this.collectionName, JSON.stringify([newName, safeOptions]));\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).rename(newName, options);\n\t\t\treturn res;\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Rename', this.collectionName, newName, safeOptions, err);\n\t\t\terr.message = `Error in Rename: ${this.collectionName} - ${newName} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync replaceOne(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T>, replacement: T, options?: ReplaceOptions, bypassLogs = false, bypassCheckSchema = false, doc: T = null, bypassSession = false) : Promise<number> {\n\t\tif (this.checkSchema && !bypassCheckSchema) {\n\t\t\tconst validation = this.simplschema.newContext();\n\t\t\tconst isValid = validation.validate(replacement);\n\n\t\t\tif (!isValid) {\n\t\t\t\tconsole.log(new Date(), this.collectionName, 'Schema Errors - replaceOne', validation.validationErrors());\n\t\t\t\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on replaceOne - ' + this.collectionName, [validation.validationErrors(), replacement]);\n\t\t\t\tthrow validation.validationErrors();\n\t\t\t}\n\t\t}\n\t\t\n\t\tlet date = new Date();\n\t\t\n\t\tif (this.timestamps) {\n\t\t\treplacement.updatedAt = date;\n\t\t}\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tif (this.useVersions) {\n\t\t\tif (!doc) {\n\t\t\t\tdoc = await this.findOne(<any>filter, null, true);\n\t\t\t}\n\n\t\t\tif (doc) {\n\t\t\t\tif (this.timestamps && !replacement.createdAt && doc.createdAt) {\n\t\t\t\t\treplacement.createdAt = doc.createdAt;\n\t\t\t\t}\n\n\t\t\t\tif (doc.__v === replacement.__v) {\n\t\t\t\t\treplacement.__v += 1;\n\n\t\t\t\t\tlet versionDoc = deepCopy(doc);\n\t\t\t\t\tversionDoc._id = {_id: doc._id, __v: doc.__v};\n\n\t\t\t\t\tlet versionOptions = null;\n\t\t\t\t\tif (!sessionOptions) {\n\t\t\t\t\t\tversionOptions = {upsert: true};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tversionOptions = {session, upsert: true};\n\t\t\t\t\t}\n\n\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, versionOptions);\n\n\t\t\t\t\tif (doc.__v >= 4) {\n\t\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).deleteMany(<any>{$and: [{'_id._id': doc._id}, {'_id.__v': {$lt: doc.__v - 4}}]}, sessionOptions);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, replacement, safeOptions])) < 200000 ? JSON.stringify([doc, filter, replacement, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, replacement, safeOptions])) < 200000 ? JSON.stringify([doc, filter, replacement, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tlet monitor = MonitorMongo.create('replaceOne', this.collectionName, JSON.stringify([filter, replacement, safeOptions]));\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).replaceOne(<any>filter, replacement, options);\n\t\t\t\t\t\tif (res.acknowledged) {\n\t\t\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn res.modifiedCount;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tthrow new Error(`Error in Replace One: ${this.collectionName} - ${JSON.stringify(res, null, 2)}`);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcatch (err) {\n\t\t\t\t\t\tconsole.log(new Date(), 'Error Replace One', this.collectionName, filter, replacement, safeOptions, err);\n\t\t\t\t\t\terr.message = `Error in Replace One: ${this.collectionName} - ${err.message}`;\n\t\t\t\t\t\tthrow err;\n\t\t\t\t\t}\n\t\t\t\t\tfinally {\n\t\t\t\t\t\tawait monitor.finish();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tconsole.log('invalid version - ' + this.collectionName, doc.__v, replacement.__v);\n\n\t\t\t\t\tlet prevDoc = await ResolveIOServer.getMongoManager().collection(this.versionCollection).findOne({\n\t\t\t\t\t\t_id: <any>{\n\t\t\t\t\t\t\t_id: doc._id,\n\t\t\t\t\t\t\t__v: replacement.__v\n\t\t\t\t\t\t}\n\t\t\t\t\t}, null, true);\n\n\t\t\t\t\tif (prevDoc) {\n\t\t\t\t\t\tlet docId = doc._id;\n\t\t\t\t\t\tlet docVersion = doc.__v;\n\t\t\t\t\t\tlet updatedDoc: T = getMongoMergeUpdatedDoc(replacement, doc, prevDoc);\n\t\t\t\t\t\tupdatedDoc._id = docId;\n\t\t\t\t\t\tupdatedDoc.__v = docVersion + 1;\n\n\t\t\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\t\tid_document: docId,\n\t\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['invalidVersion - merge', doc, filter, updatedDoc, safeOptions])) < 200000 ? JSON.stringify(['invalidVersion - merge', doc, filter, updatedDoc, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: docId,\n\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['invalidVersion - merge', doc, filter, updatedDoc, safeOptions])) < 200000 ? JSON.stringify(['invalidVersion - merge', doc, filter, updatedDoc, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlet monitor = MonitorMongo.create('replaceOne', this.collectionName, JSON.stringify([filter, updatedDoc, safeOptions]));\n\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).replaceOne(<any>filter, updatedDoc, options);\n\t\t\t\t\t\t\tif (res.acknowledged) {\n\t\t\t\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn res.modifiedCount;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tthrow new Error(`Error in Replace One: ${this.collectionName} - ${JSON.stringify(res, null, 2)}`);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch (err) {\n\t\t\t\t\t\t\tconsole.log(new Date(), 'Error Replace One', this.collectionName, filter, updatedDoc, safeOptions, err);\n\t\t\t\t\t\t\terr.message = `Error in Replace One: ${this.collectionName} - ${err.message}`;\n\t\t\t\t\t\t\tthrow err;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfinally {\n\t\t\t\t\t\t\tawait monitor.finish();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tthrow new Error('Error in Replcae One: Invalid Version And Could Not Find History - DB: ' + doc.__v + ', Trying to update with :' + replacement.__v);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (options && options.upsert) {\n\t\t\t\tif (this.timestamps) {\n\t\t\t\t\treplacement.createdAt = date;\n\t\t\t\t}\n\n\t\t\t\tif (!replacement._id) {\n\t\t\t\t\treplacement._id = objectIdHexString();\n\t\t\t\t}\n\n\t\t\t\treplacement.__v = 0;\n\n\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t) {\n\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: replacement._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['upsert', filter, replacement, safeOptions])) < 200000 ? JSON.stringify(['upsert', filter, replacement, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\tid_document: replacement._id,\n\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['upsert', filter, replacement, safeOptions])) < 200000 ? JSON.stringify(['upsert', filter, replacement, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tlet monitor = MonitorMongo.create('replaceOne', this.collectionName, JSON.stringify([filter, replacement, safeOptions]));\n\n\t\t\t\ttry {\n\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).replaceOne(<any>filter, replacement, options);\n\t\t\t\t\tif (res.acknowledged) {\n\t\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn res.modifiedCount;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tthrow new Error(`Error in Replace One: ${this.collectionName} - ${JSON.stringify(res, null, 2)}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(new Date(), 'Error Replace One', this.collectionName, filter, replacement, safeOptions, err);\n\t\t\t\t\terr.message = `Error in Replace One: ${this.collectionName} - ${err.message}`;\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t\tfinally {\n\t\t\t\t\tawait monitor.finish();\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new Error('Error in Replace One: No Document');\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tif (options && options.upsert) {\n\t\t\t\tif (this.timestamps && !replacement.createdAt) {\n\t\t\t\t\treplacement.createdAt = date;\n\t\t\t\t}\n\n\t\t\t\tif (!replacement._id) {\n\t\t\t\t\treplacement._id = objectIdHexString();\n\t\t\t\t}\n\n\t\t\t\treplacement.__v = 0;\n\t\t\t}\n\n\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\tif (!options) {\n\t\t\t\t\toptions = <FindOneAndReplaceOptions>{returnDocument: 'before'};\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t(<FindOneAndReplaceOptions>options).returnDocument = 'before';\n\t\t\t\t}\n\n\t\t\t\tlet { session, ...safeOptions } = options || {};\n\n\t\t\t\tlet monitor = MonitorMongo.create('findOneAndReplace', this.collectionName, JSON.stringify([filter, replacement, safeOptions]));\n\n\t\t\t\ttry {\n\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).findOneAndReplace(<any>filter, replacement, <FindOneAndReplaceOptions>options);\n\t\t\t\t\tlet doc = res.value;\n\n\t\t\t\t\tif (doc) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: <string>doc._id,\n\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, replacement, safeOptions])) < 200000 ? JSON.stringify([doc, filter, replacement, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: <string>doc._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, replacement, safeOptions])) < 200000 ? JSON.stringify([doc, filter, replacement, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: replacement._id,\n\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['upsert', filter, replacement, safeOptions])) < 200000 ? JSON.stringify(['upsert', filter, replacement, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: replacement._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['upsert', filter, replacement, safeOptions])) < 200000 ? JSON.stringify(['upsert', filter, replacement, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(new Date(), 'Error Replace One (Find One And Replace)', this.collectionName, filter, replacement, safeOptions, err);\n\t\t\t\t\terr.message = `Error in Replace One (Find One And Replace): ${this.collectionName} - ${err.message}`;\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t\tfinally {\n\t\t\t\t\tawait monitor.finish();\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tlet monitor = MonitorMongo.create('replaceOne', this.collectionName, JSON.stringify([filter, replacement, safeOptions]));\n\n\t\t\t\ttry {\n\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).replaceOne(<any>filter, replacement, options);\n\t\t\t\t\tif (res.acknowledged) {\n\t\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn res.modifiedCount;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\treturn res.acknowledged;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(new Date(), 'Error Replace One', this.collectionName, filter, replacement, safeOptions, err);\n\t\t\t\t\terr.message = `Error in Aggregate: ${this.collectionName} - ${err.message}`;\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t\tfinally {\n\t\t\t\t\tawait monitor.finish();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tasync updateMany(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T>, update: MongoManagerUpdateFilter<T>, options?: UpdateOptions, bypassLogs = false, bypassCheckSchema = false, bypassVersions = false, bypassSession = false) : Promise<number> {\n\t\tif ((!update.$inc || JSON.stringify(update.$inc) === '{}') && (!update.$set || JSON.stringify(update.$set) === '{}') && (!update.$setOnInsert || JSON.stringify(update.$setOnInsert) === '{}') && (!update.$unset || JSON.stringify(update.$unset) === '{}')) {\n\t\t\treturn 1;\n\t\t}\n\t\t\n\t\tif (this.timestamps) {\n\t\t\tlet date = new Date();\n\n\t\t\tif (!update.$set) {\n\t\t\t\tupdate.$set = <any>{updatedAt: date};\n\t\t\t}\n\t\t\telse {\n\t\t\t\tupdate.$set.updatedAt = date;\n\t\t\t}\n\t\t}\n\n\t\tif (this.checkSchema && !bypassCheckSchema) {\n\t\t\tconst validation = this.simplschema.newContext();\n\t\t\tconst isValid = validation.validate(update, {modifier: true});\n\n\t\t\tif (!isValid) {\n\t\t\t\tconsole.log(new Date(), this.collectionName, 'Schema Errors - updateMany', validation.validationErrors());\n\t\t\t\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on updateMany - ' + this.collectionName, [validation.validationErrors(), update]);\n\t\t\t\tthrow validation.validationErrors();\n\t\t\t}\n\t\t}\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tif ((this.useVersions && !bypassVersions) || (this.createLogs && !bypassLogs)) {\n\t\t\tlet docs = await this.find(filter);\n\n\t\t\tfor (let i = 0; i < docs.length; i++) {\n\t\t\t\tlet doc = docs[i];\n\n\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t) {\n\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, update, safeOptions])) < 200000 ? JSON.stringify([doc, filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'updateMany',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, update, safeOptions])) < 200000 ? JSON.stringify([doc, filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\tmethod: 'updateMany',\n\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.useVersions) {\n\t\t\t\t\tlet versionDoc = deepCopy(doc);\n\t\t\t\t\tversionDoc._id = {_id: doc._id, __v: doc.__v};\n\n\t\t\t\t\tlet versionOptions = null;\n\t\t\t\t\tif (!sessionOptions) {\n\t\t\t\t\t\tversionOptions = {upsert: true};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tversionOptions = {session, upsert: true};\n\t\t\t\t\t}\n\t\n\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, versionOptions);\n\t\t\t\t\t\n\t\t\t\t\tif (doc.__v >= 4) {\n\t\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).deleteMany(<any>{$and: [{'_id._id': doc._id}, {'_id.__v': {$lt: doc.__v - 4}}]}, sessionOptions);\n\t\t\t\t\t}\n\t\n\t\t\t\t\tif (!objectContainsPropertyDeep(update, '__v')) {\n\t\t\t\t\t\tif (!update.$inc) {\n\t\t\t\t\t\t\tupdate.$inc = {__v: 1};\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (!update.$inc.__v) {\n\t\t\t\t\t\t\tupdate.$inc.__v = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tlet monitor = MonitorMongo.create('updateMany', this.collectionName, JSON.stringify([filter, update, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateMany(<any>filter, update, options);\n\t\t\tif (res.acknowledged) {\n\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t}\n\n\t\t\t\treturn res.modifiedCount;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow res.acknowledged;\n\t\t\t}\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Update Many', this.collectionName, filter, update, safeOptions, err);\n\t\t\terr.message = `Error in Update Many: ${this.collectionName} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync updateOne(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T>, update: MongoManagerUpdateFilter<T>, options?: UpdateOptions, bypassLogs = false, bypassCheckSchema = false, bypassSession = false) : Promise<number> {\n\t\tif (this.checkSchema && !bypassCheckSchema) {\n\t\t\tconst validation = this.simplschema.newContext();\t\t\t\n\t\t\tconst isValid = validation.validate(update, {modifier: true});\n\n\t\t\tif (!isValid) {\n\t\t\t\tconsole.log(new Date(), this.collectionName, 'Schema Errors - updateOne', validation.validationErrors());\n\t\t\t\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on updateOne - ' + this.collectionName, [validation.validationErrors(), update]);\n\t\t\t\tthrow validation.validationErrors();\n\t\t\t}\n\t\t}\n\n\t\tif ((!update.$inc || JSON.stringify(update.$inc) === '{}') && (!update.$set || JSON.stringify(update.$set) === '{}') && (!update.$setOnInsert || JSON.stringify(update.$setOnInsert) === '{}') && (!update.$unset || JSON.stringify(update.$unset) === '{}')) {\n\t\t\treturn 1;\n\t\t}\n\n\t\tlet date = new Date();\n\n\t\tif (this.timestamps) {\n\t\t\tif (!update.$set) {\n\t\t\t\tupdate.$set = <any>{updatedAt: date};\n\t\t\t}\n\t\t\telse {\n\t\t\t\tupdate.$set.updatedAt = date;\n\t\t\t}\n\t\t}\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\t\t\n\t\tif (this.useVersions) {\n\t\t\tlet doc = await this.findOne(filter, null, true);\n\n\t\t\tif (doc) {\n\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t) {\n\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, update, safeOptions])) < 200000 ? JSON.stringify([doc, filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'updateOne',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, update, safeOptions])) < 200000 ? JSON.stringify([doc, filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\tmethod: 'updateOne',\n\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tlet versionDoc = deepCopy(doc);\n\t\t\t\tversionDoc._id = {_id: doc._id, __v: doc.__v};\n\n\t\t\t\tlet versionOptions = null;\n\t\t\t\tif (!sessionOptions) {\n\t\t\t\t\tversionOptions = {upsert: true};\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tversionOptions = {session, upsert: true};\n\t\t\t\t}\n\n\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, versionOptions);\n\t\t\t\t\n\t\t\t\tif (doc.__v >= 4) {\n\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).deleteMany(<any>{$and: [{'_id._id': doc._id}, {'_id.__v': {$lt: doc.__v - 4}}]}, sessionOptions);\n\t\t\t\t}\n\n\t\t\t\tif (!objectContainsPropertyDeep(update, '__v')) {\n\t\t\t\t\tif (!update.$inc) {\n\t\t\t\t\t\tupdate.$inc = {__v: 1};\n\t\t\t\t\t}\n\t\t\t\t\telse if (!update.$inc.__v) {\n\t\t\t\t\t\tupdate.$inc.__v = 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tlet monitor = MonitorMongo.create('updateOne', this.collectionName, JSON.stringify([filter, update, safeOptions]));\n\n\t\t\t\ttry {\n\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateOne(<any>filter, update, options);\n\t\t\t\t\tif (res.acknowledged) {\n\t\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn res.modifiedCount;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tthrow new Error(`Error in Update One: ${this.collectionName} - ${JSON.stringify(res, null, 2)}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(new Date(), 'Error Update One', this.collectionName, filter, update, safeOptions, err);\n\t\t\t\t\terr.message = `Error in Update One: ${this.collectionName} - ${err.message}`;\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t\tfinally {\n\t\t\t\t\tawait monitor.finish();\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (options && options.upsert) {\n\t\t\t\tif (!update.$setOnInsert) {\n\t\t\t\t\tif (this.timestamps) {\n\t\t\t\t\t\tupdate.$setOnInsert = <any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t__v: 0,\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tupdate.$setOnInsert = <any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t__v: 0\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (!update.$setOnInsert._id) {\n\t\t\t\t\t\tupdate.$setOnInsert._id = objectIdHexString();\n\t\t\t\t\t}\n\n\t\t\t\t\tif (this.timestamps && !update.$setOnInsert.createdAt) {\n\t\t\t\t\t\tupdate.$setOnInsert.createdAt = new Date();\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t) {\n\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: update.$setOnInsert._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['upsert', filter, update, safeOptions])) < 200000 ? JSON.stringify(['upsert', filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'updateOne',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\tid_document: update.$setOnInsert._id,\n\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['upsert', filter, update, safeOptions])) < 200000 ? JSON.stringify(['upsert', filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\tmethod: 'updateOne',\n\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tlet monitor = MonitorMongo.create('updateOne', this.collectionName, JSON.stringify([filter, update, safeOptions]));\n\n\t\t\t\ttry {\n\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateOne(<any>filter, update, options);\n\t\t\t\t\tif (res.acknowledged) {\n\t\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn res.modifiedCount;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tthrow new Error(`Error in Update One: ${this.collectionName} - ${JSON.stringify(res, null, 2)}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(new Date(), 'Error Update One', this.collectionName, filter, update, safeOptions, err);\n\t\t\t\t\terr.message = `Error in Update One: ${this.collectionName} - ${err.message}`;\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t\tfinally {\n\t\t\t\t\tawait monitor.finish();\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new Error('Error in Update One: No Document');\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tif (options && options.upsert) {\n\t\t\t\tif (!update.$setOnInsert) {\n\t\t\t\t\tif (this.timestamps) {\n\t\t\t\t\t\tupdate.$setOnInsert = <any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tupdate.$setOnInsert = <any>{\n\t\t\t\t\t\t\t_id: objectIdHexString()\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (!update.$setOnInsert._id) {\n\t\t\t\t\t\tupdate.$setOnInsert._id = objectIdHexString();\n\t\t\t\t\t}\n\n\t\t\t\t\tif (this.timestamps && !update.$setOnInsert.createdAt) {\n\t\t\t\t\t\tupdate.$setOnInsert.createdAt = new Date();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\tif (!options) {\n\t\t\t\t\toptions = <FindOneAndUpdateOptions>{returnDocument: 'before'};\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t(<FindOneAndUpdateOptions>options).returnDocument = 'before';\n\t\t\t\t}\n\n\t\t\t\tlet monitor = MonitorMongo.create('findOneAndUpdate', this.collectionName, JSON.stringify([filter, update, safeOptions]));\n\n\t\t\t\ttry {\n\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).findOneAndUpdate(<any>filter, update, <FindOneAndUpdateOptions>options);\n\t\t\t\t\tlet doc = res.value;\n\n\t\t\t\t\tif (doc) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: <any>doc._id,\n\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, update, safeOptions])) < 200000 ? JSON.stringify([doc, filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: 'updateOne',\n\t\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: <any>doc._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, update, safeOptions])) < 200000 ? JSON.stringify([doc, filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'updateOne',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn res.ok;\n\t\t\t\t\t}\n\t\t\t\t\telse if (update.$setOnInsert) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: update.$setOnInsert._id,\n\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['upsert', filter, update, safeOptions])) < 200000 ? JSON.stringify(['upsert', filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: 'updateOne',\n\t\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: update.$setOnInsert._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['upsert', filter, update, safeOptions])) < 200000 ? JSON.stringify(['upsert', filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'updateOne',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn res.ok;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(new Date(), 'Error Update One (Find One And Update)', this.collectionName, filter, update, safeOptions, err);\n\t\t\t\t\terr.message = `Error in Update One (Find One And Update): ${this.collectionName} - ${err.message}`;\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t\tfinally {\n\t\t\t\t\tawait monitor.finish();\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tlet monitor = MonitorMongo.create('updateOne', this.collectionName, JSON.stringify([filter, update, safeOptions]));\n\n\t\t\t\ttry {\n\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateOne(<any>filter, update, options);\n\t\t\t\t\tif (res.acknowledged) {\n\t\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn res.modifiedCount;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tthrow new Error(`Error in Aggregate: ${this.collectionName} - ${JSON.stringify(res, null, 2)}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(new Date(), 'Error Update One', this.collectionName, filter, update, safeOptions, err);\n\t\t\t\t\terr.message = `Error in Aggregate: ${this.collectionName} - ${err.message}`;\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t\tfinally {\n\t\t\t\t\tawait monitor.finish();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t\n\twatchCollection(pipeline = [], options?: ChangeStreamOptions, bypassSession = false): ChangeStream<T> {\n\t\tconst session = ResolveIOServer.getMongoManager().getSession();\n\t\tif (session && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = session;\n\t\t\t}\n\t\t}\n\t\t\n\t\tlet stream = ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).watch(pipeline, options);\n\t\treturn <ChangeStream<T>>stream;\n\t}\n}\n\nexport class MongoManagerUserCollection<T extends CollectionDocument> extends MongoManagerCollection<T> {\n\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, cb) => {\n\t\t\treturn Users.findOne({username: username});\n\t\t};\n\t}\n\n\tasync setPassword(user: UserModel, password: string) {\n\t\tif (!user) {\n\t\t\tthrow new Error('Error In User Set Password: No User');\n\t\t}\n\t\telse if (!password) {\n\t\t\tthrow new Error('Error In User Set Password: No Password');\n\t\t}\n\t\telse {\n\t\t\tlet saltBuffer = await randomBytes(32);\n\t\t\tlet salt = saltBuffer.toString('hex');\n\t\t\ttry {\n\t\t\t\tlet hashRaw = await pbkdf2Promisified(password, salt, {\n\t\t\t\t\titerations: 25000,\n\t\t\t\t\tkeylen: 512,\n\t\t\t\t\tdigestAlgorithm: 'sha256'\n\t\t\t\t});\n\t\t\t\tlet hash = Buffer.from(hashRaw, 'binary').toString('hex');\n\t\t\t\t\n\t\t\t\treturn Users.updateOne({_id: user._id}, {$set: {hash: hash, salt: salt, services: {}, attempts: 0}});\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\terr.message = `Error in User Set Password: ${JSON.stringify(user, null, 2)} - ${err.message}`;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t}\n\t};\n\n\tasync changePassword(user, oldPassword, newPassword) {\n\t\tif (!user) {\n\t\t\tthrow new Error('Error in User Change Password: Missing User');\n\t\t}\n\t\telse if (!oldPassword || !newPassword) {\n\t\t\tthrow new Error('Error in User Change Password: Missing Password');\n\t\t}\n\t\telse {\n\t\t\tlet authUser = await this.authenticate(user, oldPassword);\n\n\t\t\tif (!authUser['data']) {\n\t\t\t\tthrow authUser['error'];\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn this.setPassword(user, newPassword);\n\t\t\t}\n\t\t}\n\t}\n\t\n\tasync register(user, password) {\n\t\tif (!user.username) {\n\t\t\tthrow new Error('Error in User Register: Missing Username');\n\t\t}\n\t\telse {\n\t\t\tlet dbUser = await Users.findOne({username: user.username});\n\t\t\t\n\t\t\tif (dbUser) {\n\t\t\t\tthrow new Error('Error in User Register: Username Exists');\n\t\t\t}\n\t\t\telse {\n\t\t\t\tdbUser = await Users.findOne({email: user.email});\n\n\t\t\t\tif (dbUser) {\n\t\t\t\t\tthrow new Error('Error in User Register: Email Exists');\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tuser.setPassword(password);\n\t\t\t\t\treturn user;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tresetAttempts(user: UserModel) {\n\t\treturn Users.updateOne({_id: user._id}, {$set: {attempts: 0}});\n\t}\n}\n\nfunction pbkdf2(password, salt, options, callback) {\n\tcrypto.pbkdf2(password, salt, options.iterations, options.keylen, options.digestAlgorithm, callback);\n};\n\nfunction pbkdf2Promisified(password, salt, options): Promise<any> {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn new Promise((resolve, reject) => pbkdf2(password, salt, options, (err, hashRaw) => (err ? reject(err) : resolve(hashRaw))));\n}\n\nfunction randomBytes(saltlen): Promise<Buffer> {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn new Promise((resolve, reject) => crypto.randomBytes(saltlen, (err, saltBuffer) => (err ? reject(err) : resolve(saltBuffer))));\n}\n\nfunction objectContainsPropertyDeep(obj: Object, prop: string) {\n\tlet keys = Object.keys(obj);\n\n\tif (keys.some(a => a === prop)) {\n\t\treturn true;\n\t}\n\t\n\tfor (let i = 0; i < keys.length; i++) {\n\t\tlet key = keys[i];\n\t\tif (obj[key] && typeof obj[key] === 'object' && objectContainsPropertyDeep(obj[key], prop)) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}"]}
1
+ {"version":3,"sources":["../../src/managers/mongo.manager.ts"],"names":["async_1","require","NodeCache","os_1","simpl_schema_1","user_collection_1","resolveio_server_app_1","common_1","monitor_manager_1","crypto","scmp","numCPUs","cpus","length","v8","AsyncLocalStorage","asyncLocalStorage","MongoManager","this","_collections","_cacheMap","_operationInProgress","Map","_heapSize","getHeapStatistics","_serverCollections","_isWorkersEnabled","_isWorkerInstance","create","mongoManager","initialize","_a","sent","prototype","_nodeCache","stdTTL","checkperiod","process","env","IS_WORKERS_ENABLED","IS_WORKER_INSTANCE","setCacheLimit","setupChangeStream","ResolveIOServer","getMainDB","listCollections","toArray","collections","oneTimeTransaction","fn","run","__awaiter","_this","session","getMongoConnection","startSession","getStore","withTransaction","endSession","store","getSession","_heapLimit","getServerCollections","registerCollection","collection","collectionOptions","timeseries","timeField","some","a","name","collectionName","type","dropCollection","createCollection","push","find","delay","ms","Promise","resolve","setTimeout","filter","options","safeOptions","__rest","cacheKey","generateCacheKey","undefined","result","getFromCache","getMainServer","getSubscriptionManager","getEnableDebug","console","log","Date","has","get","promise","operation","executeFind","set","invalidatedDuringExecution","finally","delete","_b","monitor","MonitorMongo","JSON","stringify","message","concat","err_2","finish","addToCache","findOne","executeFindOne","err_3","aggregate","pipeline","__spreadArray","__read","flatMap","stage","$lookup","from","executeAggregate","err_4","countDocuments","executeCountDocuments","err_5","functionName","args","keyString","createHash","update","digest","cachedData","parse","dateReviver","error","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","err","close","MongoManagerModel","exports","collection_main","collection_version","mongoManagerModel","versionOptions","MongoManagerUserCollection","MongoManagerCollection","useVersionCollection","useVersions","versionSchema","deepCopy","schema","_id","blackbox","useReportBuilder","reportBuilderLookupTables","timestamps","createLogs","checkSchema","skipCache","setImmediate","createIndex","_id._id","_id.__v","versionCollection","simplschema","rbSchema","useRB","bypassSession","mongoManagerCollection","schemaCopy","interval","default","buildRbLookups","buildRbSchema","setInterval","getMongoManager","clearInterval","extractIndexNameFromError","errorMessage","matches","match","mongoSession","err_6","aggregateCount","err_7","aggregateCursor","cursor","ev","aggregateStream","streamOptions","stream","bulkWrite","operations","bypassCheckSchema","bypassLogs","bypassVersions","BATCH_SIZE","opIndex","sessionOptions","batchOps","slice","logs","versionOps","e_5","batchOps_1","batchOps_1_1","op","opType","Object","doc","validationContext","newContext","isValid","validate","document","replacement","modifier","Error","validationErrors","createdAt","updatedAt","insertOne","objectIdHexString","id_document","payload","method","id_user","user","messageId","route","versionDoc","__assign","__v","$set","$inc","affectedDocs","versionFilters","map","v","$or","versionInserts","bwOptions","ordered","e_4","err_8","getServerConfig","getLocalLogManager","writeLogs","affectedDocIds","$in","$sort","$group","versions","$push","$project","versionsToDelete","$slice","$size","$unwind","$replaceRoot","newRoot","oldVersions","deleteMany","error_1","ok","estimatedDocumentCount","err_9","f_docs","Array","isArray","insertMany","fieldOrSpec","indexes","existingIndexes","index","indexQueue","action","specs","createIndexes","indexSpecs","existingIndexes_1","indexesToCreate","indexSpec","existingIndex","docs","i","writeLog","upsert","replaceOne","$lt","res","acknowledged","deletedCount","err_12","deleteOne","findOneAndDelete","returnVal","err_13","err_14","distinct","err_15","drop","err_16","dropIndex","indexName","err_17","dropIndexes","err_18","err_19","findById","id","err_20","findCount","count","err_21","findCursor","removeAllListeners","findStream","err_22","err_23","findOneAndReplace","validation","getMethodManager","callMethod","call","date","err_24","findOneAndUpdate","$setOnInsert","err_25","err_26","indexExists","err_27","bypassMonitor","validationResults","forEach","validDocs","idx","hasOwnProperty","err_28","err_29","listIndexes","rename","newName","err_30","modifiedCount","err_31","prevDoc","docId","docVersion","updatedDoc","getMongoMergeUpdatedDoc","err_32","err_33","returnDocument","safeOptions_1","doc_1","err_34","err_35","updateMany","$unset","objectContainsPropertyDeep","err_36","updateOne","err_37","err_38","err_39","err_40","watchCollection","queue","task","callback","dbCollection","apply","code","err_41","existingIndexName","innerError_1","_super","__extends","authenticate","password","attemptsInterval","Math","pow","attempts","calculatedInterval","last","now","getTime","Users","salt","pbkdf2Promisified","iterations","keylen","digestAlgorithm","hashBuffer","Buffer","hash","err_42","serializeUser","cb","username","deserializeUser","setPassword","randomBytes","saltBuffer","toString","hashRaw","services","err_43","changePassword","oldPassword","newPassword","authUser","register","email","resetAttempts","pbkdf2","reject","saltlen","obj","prop"],"mappings":"02GAAAA,S,+KAAAC,QAAA,OAAA,GAEAC,UAAAD,QAAA,YAAA,EACAE,KAAAF,QAAA,IAAA,EACAG,eAAAH,QAAA,cAAA,EACAI,kBAAAJ,QAAA,gCAAA,EAIAK,uBAAAL,QAAA,yBAAA,EACAM,SAAAN,QAAA,gBAAA,EACAO,kBAAAP,QAAA,mBAAA,EACMQ,OAASR,QAAQ,QAAQ,EACzBS,KAAOT,QAAQ,MAAM,EACrBU,SAAU,EAAAR,KAAAS,MAAI,EAAGC,OACjBC,GAAKb,QAAQ,IAAI,EACfc,kBAAsBd,QAAQ,aAAa,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ChR,EAAM2R,EAAO3R,CAAG,EAAIpG,EAAQoX,CAAO,CAApC,CAAsC,CAAxF,CAAyF,CAClI,CAEA,SAASH,YAAYe,GAEpB,OAAO,IAAIjY,QAAQ,SAACC,EAAS+X,GAAW,OAAAtc,OAAOwb,YAAYe,EAAS,SAAC5R,EAAK8Q,GAAe,OAAC9Q,EAAM2R,EAAO3R,CAAG,EAAIpG,EAAQkX,CAAU,CAAvC,CAAyC,CAA1F,CAA2F,CACpI,CAEA,SAAS7C,2BAA2B4D,EAAaC,GAChD,IAAI1T,EAAOoG,OAAOpG,KAAKyT,CAAG,EAE1B,GAAIzT,EAAKpF,KAAK,SAAAC,GAAK,OAAAA,IAAM6Y,CAAN,CAAU,EAC5B,MAAO,CAAA,EAGR,IAAK,IAAIzI,EAAI,EAAGA,EAAIjL,EAAK3I,OAAQ4T,CAAC,GAAI,CACrC,IAAI3K,EAAMN,EAAKiL,GACf,GAAIwI,EAAInT,IAA4B,UAApB,OAAOmT,EAAInT,IAAqBuP,2BAA2B4D,EAAInT,GAAMoT,CAAI,EACxF,MAAO,CAAA,C,CAIT,MAAO,CAAA,CACR,CA/La3R,QAAAK,2BAAAA","file":"mongo.manager.js","sourcesContent":["import async from 'async';\nimport { AggregateOptions, AggregationCursor, BulkWriteOptions, BulkWriteResult, ChangeStream, ChangeStreamOptions, Collection, CollectionInfo, CommandOperationOptions, CountDocumentsOptions, CreateCollectionOptions, CreateIndexesOptions, CursorStreamOptions, DeleteOptions, FindCursor, FindOneAndDeleteOptions, FindOneAndReplaceOptions, FindOneAndUpdateOptions, FindOptions, IndexDescription, IndexInformationOptions, InsertOneOptions, ListIndexesCursor, ListIndexesOptions, OptionalUnlessRequiredId, RenameOptions, ReplaceOptions, UpdateOptions } from 'mongodb';\nimport * as NodeCache from 'node-cache';\nimport { cpus } from 'os';\nimport SimpleSchema from 'simpl-schema';\nimport { Users } from '../collections/user.collection';\nimport { CollectionDocument, Document } from '../models/collection-document.model';\nimport { LookupTables } from '../models/report-builder.model';\nimport { UserModel } from '../models/user.model';\nimport { ResolveIOServer } from '../resolveio-server-app';\nimport { buildRbLookups, buildRbSchema, dateReviver, deepCopy, getBinarySize, getMongoMergeUpdatedDoc, objectIdHexString } from '../util/common';\nimport { MonitorMongo } from './monitor.manager';\nconst crypto = require('crypto');\nconst scmp = require('scmp');\nconst numCPUs = cpus().length;\nconst v8 = require('v8');\nconst { AsyncLocalStorage } = require('async_hooks');\nconst asyncLocalStorage = new AsyncLocalStorage();\n\n// export declare interface MongoManagerFilterOperators<T> extends Document {\nexport declare interface MongoManagerFilterParamaterOperators<P> {\n\t$eq?: P;\n\t$gt?: P;\n\t$gte?: P;\n\t$in?: P extends Array<any> ? P : P[];\n\t$lt?: P;\n\t$lte?: P;\n\t$ne?: P;\n\t$nin?: P extends Array<any> ? P : P[];\n\t$not?: P extends string ? MongoManagerFilterParamaterOperators<P> | RegExpConstructor : MongoManagerFilterParamaterOperators<P>;\n\t$exists?: boolean;\n\t$expr?: any[]\n\t$regex?: P extends string ? RegExpConstructor | string : never;\n\t$options?: P extends string ? string : never;\n\t$geoIntersects?: {\n\t\t$geometry: Document;\n\t};\n\t$geoWithin?: Document;\n\t$near?: Document;\n\t$nearSphere?: Document;\n\t$maxDistance?: number;\n\t$all?: any[];\n\t$elemMatch?: Document;\n\t$size?: P extends any[] ? number : never;\n}\n\nexport declare interface MongoManagerFilterOperators<T> extends Document { //TODO: Remove extends document when I get answer on S.O.\n\t$and?: MongoManagerFilter<T>[] | MongoManagerFilterOperators<T>;\n\t$nor?: MongoManagerFilter<T>[] | MongoManagerFilterOperators<T>;\n\t$or?: MongoManagerFilter<T>[] | MongoManagerFilterOperators<T>;\n\t$text?: {\n\t\t$search: string;\n\t\t$language?: string;\n\t\t$caseSensitive?: boolean;\n\t\t$diacriticSensitive?: boolean;\n\t};\n\t$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[P in keyof T]?: number | boolean;\n};\n\nexport declare type MongoManagerIncFilter<T> = {\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\tasync oneTimeTransaction<T>(fn: () => Promise<T>): Promise<T> {\n\t\treturn await asyncLocalStorage.run({}, async () => {\n\t\t\tconst session = ResolveIOServer.getMongoConnection().startSession();\n\t\t\tasyncLocalStorage.getStore().session = session;\n\n\t\t\ttry {\n\t\t\t\t// Let withTransaction return the value from fn()\n\t\t\t\treturn await session.withTransaction(async () => {\n\t\t\t\t\treturn fn();\n\t\t\t\t});\n\t\t\t} \n\t\t\tcatch (err) {\n\t\t\t\tthrow err;\n\t\t\t} \n\t\t\tfinally {\n\t\t\t\tawait session.endSession();\n\t\t\t\t\n\t\t\t\tlet store = asyncLocalStorage.getStore();\n\t\t\t\tif (store) {\n\t\t\t\t\tdelete store.session; // or store.session = undefined\n\t\t\t\t}\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\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\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(<any>filter, options).toArray();\n\t\t}\n\t\tcatch (err) {\n\t\t\terr.message = `Error in Execute Find (${collectionName}): ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t\n\t\tif (!this._operationInProgress.get(cacheKey).invalidatedDuringExecution) {\n\t\t\tthis.addToCache([collectionName], cacheKey, result);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t// FindOne Operation\n\tpublic async findOne<T extends CollectionDocument>(\n\t\tcollectionName: string,\n\t\tfilter: MongoManagerFilter<T> | MongoManagerFilterOperators<T> = {},\n\t\toptions?: FindOptions<T>\n\t): Promise<T> {\n\t\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\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(<any>filter, options);\n\t\t}\n\t\tcatch (err) {\n\t\t\terr.message = `Error in Execute Find One (${collectionName}): ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t\n\t\tif (!this._operationInProgress.get(cacheKey).invalidatedDuringExecution) {\n\t\t\tthis.addToCache([collectionName], cacheKey, result);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t// Aggregate Operation\n\tpublic async aggregate<T extends CollectionDocument>(\n\t\tcollectionName: string,\n\t\tpipeline: any[],\n\t\toptions?: AggregateOptions\n\t): Promise<any[]> {\n\t\tconst collections = [collectionName, ...pipeline.flatMap(stage => stage.$lookup?.from ? [stage.$lookup.from] : [])];\n\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\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(pipeline, options).toArray();\n\t\t}\n\t\tcatch (err) {\n\t\t\terr.message = `Error in Execute Aggregate (${collectionName}): ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\n\t\tif (!this._operationInProgress.get(cacheKey).invalidatedDuringExecution) {\n\t\t\tthis.addToCache(collections, cacheKey, result);\n\t\t}\n\t\t\n\t\treturn result;\n\t}\n\n\tpublic async countDocuments<T extends CollectionDocument>(\n\t\tcollectionName: string,\n\t\tfilter: MongoManagerFilter<T> | MongoManagerFilterOperators<T> = {},\n\t\toptions?: CountDocumentsOptions\n\t): Promise<number> {\n\t\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\tlet { session, ...safeOptions } = options || {};\n\t\tconst monitor = MonitorMongo.create('countDocuments', collectionName, JSON.stringify([filter, safeOptions]));\n\n\t\ttry {\n\t\t\tresult = await collection.countDocuments(<any>filter, options);\n\t\t}\n\t\tcatch (err) {\n\t\t\terr.message = `Error in Execute Count Documents (${collectionName}): ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t\n\t\tif (!this._operationInProgress.get(cacheKey).invalidatedDuringExecution) {\n\t\t\tthis.addToCache([collectionName], cacheKey, result);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t// Cache and Invalidation Setup\n\tprivate generateCacheKey(collections: string[], functionName: string, args: any[]): string {\n\t\tconst keyString = JSON.stringify({ collections, functionName, args });\n\t\treturn crypto.createHash('sha256').update(keyString).digest('hex');\n\t}\n\n\tprivate getFromCache(cacheKey: string): any | undefined {\n\t\ttry {\n\t\t\tconst cachedData = this._nodeCache.get(cacheKey);\n\t\t\tif (cachedData) {\n\t\t\t\treturn JSON.parse(cachedData, dateReviver);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tthis._nodeCache.del(cacheKey);\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate addToCache(collections: string[], cacheKey: string, data: any) {\n\t\tif (getBinarySize(JSON.stringify(data)) < 1000000 && \n\t\t\t!collections.includes('logs') &&\n\t\t\t!collections.find(a => a.endsWith('.versions')) &&\n\t\t\t!collections.find(a => a.startsWith('monitor-'))\n\t\t) {\n\t\t\tlet nodeCacheSize = this._nodeCache.getStats().vsize;\n\n\t\t\tif (nodeCacheSize > this._heapLimit) {\n\t\t\t\tlet deleteCount = 0;\n\t\t\t\tconst keys = this._nodeCache.keys();\n\n\t\t\t\tfor (const key of keys) {\n\t\t\t\t\tthis._nodeCache.del(key);\n\t\t\t\t\tdeleteCount += 1;\n\n\t\t\t\t\tnodeCacheSize = this._nodeCache.getStats().vsize;\n\n\t\t\t\t\tif (nodeCacheSize < this._heapLimit * 0.75) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconsole.log('Query Cache: ' + 'Too Big, - Deleted: ' + deleteCount + ' - ' + nodeCacheSize);\n\t\t\t}\n\t\t\t\n\t\t\tthis._nodeCache.set(cacheKey, JSON.stringify(data));\n\t\t\tthis._cacheMap.push({ collections, key: cacheKey });\n\t\t}\n\t}\n\n\tpublic invalidateQueryCache(collection: string) {\n\t\tconst collectionCacheMap = this._cacheMap.filter(a => a.collections.includes(collection));\n\n\t\tif (ResolveIOServer.getMainServer().getSubscriptionManager() && ResolveIOServer.getMainServer().getSubscriptionManager().getEnableDebug()) {\n\t\t\tconsole.log(new Date(), 'Mongo Invalidate Cache', collection);\n\t\t}\n\n\t\tfor (const cacheMap of collectionCacheMap) {\n\t\t\tthis._nodeCache.del(cacheMap.key);\n\t\t\t\n\t\t\tif (this._operationInProgress.has(cacheMap.key)) {\n\t\t\t\tthis._operationInProgress.get(cacheMap.key).invalidatedDuringExecution = true;\n\n\t\t\t\tif (ResolveIOServer.getMainServer().getSubscriptionManager() && ResolveIOServer.getMainServer().getSubscriptionManager().getEnableDebug()) {\n\t\t\t\t\tconsole.log(new Date(), 'Mongo Invalidated During Execution', cacheMap.collections);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\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 err => {\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\tprivate initialize(options: MongoManagerCollectionOptions) {\n\t\tthis.collectionName = options.collectionName;\n\t\tthis.simplschema = new SimpleSchema(options.schema);\n\t\tthis.timestamps = options.timestamps;\n\t\tthis.createLogs = options.createLogs;\n\t\tthis.checkSchema = options.checkSchema;\n\t\tthis.collectionOptions = options.collectionOptions;\n\t\tthis.skipCache = options.skipCache || false;\n\t\tthis.bypassSession = options.bypassSession || false;\n\n\t\tif (options.useReportBuilder) {\n\t\t\tthis.useRB = true;\n\t\t\tlet schemaCopy = deepCopy(options.schema);\n\t\t\tlet rbSchema = buildRbLookups(options.reportBuilderLookupTables, schemaCopy, []);\n\t\t\tthis.rbSchema = buildRbSchema(rbSchema);\n\t\t}\n\n\t\tlet interval = setInterval(async () => {\n\t\t\tif (ResolveIOServer && ResolveIOServer.getMainServer() && ResolveIOServer.getMongoManager() && ResolveIOServer.getMongoManager().getServerCollections().length) {\n\t\t\t\tawait ResolveIOServer.getMongoManager().registerCollection(this);\n\t\t\t\tclearInterval(interval);\n\t\t\t}\n\t\t}, 1);\n\t}\n\n\tprivate static indexQueue = async.queue(async (task, callback) => {\n\t\tconst { action, collection, specs, options } = task;\n\t\tconst dbCollection = ResolveIOServer.getMainDB().collection(collection.collectionName, collection.collectionOptions);\n\t\n\t\tif (!dbCollection) {\n\t\t\treturn callback(new Error(`Collection ${collection.collectionName} not found`));\n\t\t}\n\t\n\t\ttry {\n\t\t\t// Try creating the index, will auto-skip if already checked in createIndex/createIndexes\n\t\t\tconst result = await dbCollection[action](...specs, options);\n\t\t\tcallback(null, result);\n\t\t} catch (err) {\n\t\t\t// Handle any specific errors related to index creation\n\t\t\tif (err.code === 85 || err.message.includes('IndexOptionsConflict')) {\n\t\t\t\ttry {\n\t\t\t\t\tconst existingIndexName = collection.extractIndexNameFromError(err.message);\n\t\t\t\t\tif (existingIndexName) {\n\t\t\t\t\t\tawait dbCollection.dropIndex(existingIndexName);\n\t\t\t\t\t\tconst result = await dbCollection[action](...specs, options);\n\t\t\t\t\t\tcallback(null, result);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t} catch (innerError) {\n\t\t\t\t\tcallback(innerError);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcallback(err);\n\t\t}\n\t}, 1);\n\n\t// Method to extract index name from error message\n\textractIndexNameFromError(errorMessage) {\n\t\tlet regexPattern = /Index already exists with a different name: (\\S+)/;\n\t\tlet matches = errorMessage.match(regexPattern);\n\t\n\t\tif (!matches || matches.length <= 1) {\n\t\t\t// If the first pattern doesn't match, try the second pattern\n\t\t\tregexPattern = /existing index:.*name: \"([^\"]+)\"/;\n\t\t\tmatches = errorMessage.match(regexPattern);\n\t\t}\n\t\n\t\treturn matches && matches.length > 1 ? matches[1] : null;\n\t}\n\n\tasync aggregate(pipeline: object[], options?: AggregateOptions, skipCache = false, bypassSession = false) : Promise<any[]> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (!skipCache && !this.skipCache) {\n\t\t\treturn ResolveIOServer.getMongoManager().aggregate(this.collectionName, pipeline, options);\n\t\t}\n\t\telse {\n\t\t\tlet { session, ...safeOptions } = options || {};\n\t\t\tlet monitor = MonitorMongo.create('aggregate', this.collectionName, JSON.stringify([pipeline, safeOptions]));\n\n\t\t\ttry {\n\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).aggregate(pipeline, options).toArray();\n\t\t\t\treturn res;\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tconsole.log(new Date(), 'Error Aggregate', this.collectionName, JSON.stringify([pipeline, safeOptions, err], null, 2));\n\t\t\t\terr.message = `Error in Aggregate: ${this.collectionName} - ${err.message}`;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tawait monitor.finish();\n\t\t\t}\n\t\t}\n\t}\n\n\tasync aggregateCount(pipeline: object[], options?: AggregateOptions, bypassSession = false) : Promise<number> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\t\tlet monitor = MonitorMongo.create('aggregateCount', this.collectionName, JSON.stringify([pipeline, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).aggregate(pipeline, options).toArray();\n\t\t\treturn res.length;\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Aggregate Count', this.collectionName, JSON.stringify([pipeline, safeOptions, err], null, 2));\n\t\t\terr.message = `Error in Aggregate Count: ${this.collectionName} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\taggregateCursor(pipeline: object[], options?: AggregateOptions, bypassSession = false): AggregationCursor {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\t\tlet monitor = MonitorMongo.create('aggregateCursor', this.collectionName, JSON.stringify([pipeline, safeOptions]));\n\t\tlet cursor = ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).aggregate(pipeline, options);\n\t\tcursor.on('close', async ev => {\n\t\t\tawait monitor.finish();\n\t\t\treturn ev;\n\t\t});\n\n\t\treturn cursor;\n\t}\n\n\taggregateStream(pipeline: object[], options?: AggregateOptions, streamOptions?: CursorStreamOptions, bypassSession = false) {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\t\tlet monitor = MonitorMongo.create('aggregateStream', this.collectionName, JSON.stringify([pipeline, safeOptions, streamOptions]));\n\t\tlet stream = ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).aggregate(pipeline, options).stream(streamOptions).on('close', async ev => {\n\t\t\tawait monitor.finish();\n\t\t\treturn ev;\n\t\t});\n\n\t\treturn stream;\n\t}\n\n\tasync bulkWrite(\n\t\toperations: any[],\n\t\toptions?: BulkWriteOptions,\n\t\tbypassCheckSchema = false,\n\t\tbypassLogs = false,\n\t\tbypassVersions = false, \n\t\tbypassSession = false\n\t): Promise<BulkWriteResult> {\n\t\tif (!operations.length) {\n\t\t\treturn null;\n\t\t}\n\t\n\t\tconst BATCH_SIZE = 1000;\n\t\tlet opIndex = 0;\n\n\t\tlet sessionOptions = null;\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\t\n\t\twhile (opIndex < operations.length) {\n\t\t\tconst batchOps = operations.slice(opIndex, opIndex + BATCH_SIZE);\n\t\n\t\t\t// Initialize arrays for logs and version operations\n\t\t\tconst logs = [];\n\t\t\tconst versionOps = [];\n\t\n\t\t\tfor (const op of batchOps) {\n\t\t\t\tconst opType = Object.keys(op)[0];\n\t\t\t\tconst doc = op[opType];\n\t\n\t\t\t\t// Skip validation if bypassCheckSchema is true\n\t\t\t\tif (this.checkSchema && !bypassCheckSchema) {\n\t\t\t\t\tconst validationContext = this.simplschema.newContext();\n\t\t\t\t\tlet isValid: boolean;\n\t\n\t\t\t\t\tif (opType === 'insertOne') {\n\t\t\t\t\t\tisValid = validationContext.validate(doc.document);\n\t\t\t\t\t}\n\t\t\t\t\telse if (opType === 'replaceOne') {\n\t\t\t\t\t\tisValid = validationContext.validate(doc.replacement);\n\t\t\t\t\t}\n\t\t\t\t\telse if (opType === 'updateOne' || opType === 'updateMany') {\n\t\t\t\t\t\t// For updates, validate the update modifier\n\t\t\t\t\t\tisValid = validationContext.validate(doc.update, { modifier: true });\n\t\t\t\t\t}\n\t\t\t\t\telse if (opType === 'deleteOne' || opType === 'deleteMany') {\n\t\t\t\t\t\t// No validation needed for deletes\n\t\t\t\t\t\tisValid = true;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tthrow new Error(`Unsupported operation type: ${opType}`);\n\t\t\t\t\t}\n\t\n\t\t\t\t\tif (!isValid) {\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t`Schema validation failed for ${opType}: ${JSON.stringify(validationContext.validationErrors())}`\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\t// Now proceed to process the operations\n\t\n\t\t\t\tif (opType === 'insertOne') {\n\t\t\t\t\t// If this.timestamps is true, set createdAt and updatedAt\n\t\t\t\t\tif (this.timestamps) {\n\t\t\t\t\t\tif (!doc.document.createdAt) {\n\t\t\t\t\t\t\tdoc.document.createdAt = new Date();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (!doc.document.updatedAt) {\n\t\t\t\t\t\t\tdoc.document.updatedAt = new Date();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Prepare log entry\n\t\t\t\t\tif (!bypassLogs && this.createLogs) {\n\t\t\t\t\t\tlogs.push({\n\t\t\t\t\t\t\tinsertOne: {\n\t\t\t\t\t\t\t\tdocument: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: doc.document._id || objectIdHexString(),\n\t\t\t\t\t\t\t\t\tpayload:\n\t\t\t\t\t\t\t\t\t\tgetBinarySize(JSON.stringify(doc.document)) < 200000\n\t\t\t\t\t\t\t\t\t\t\t? JSON.stringify(doc.document, null, 2)\n\t\t\t\t\t\t\t\t\t\t\t: 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: 'insertOne',\n\t\t\t\t\t\t\t\t\tid_user: '', // Add user info if available\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date(),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Prepare version document\n\t\t\t\t\tif (!bypassVersions && this.useVersions) {\n\t\t\t\t\t\tconst versionDoc = {\n\t\t\t\t\t\t\t...doc.document,\n\t\t\t\t\t\t\t__v: 0,\n\t\t\t\t\t\t\t_id: { _id: doc.document._id || objectIdHexString(), __v: 0 },\n\t\t\t\t\t\t};\n\t\t\t\t\t\tversionOps.push({\n\t\t\t\t\t\t\tinsertOne: {\n\t\t\t\t\t\t\t\tdocument: versionDoc\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Since we might have modified doc.document, update the operation\n\t\t\t\t\top[opType].document = doc.document;\n\t\t\t\t}\n\t\t\t\telse if (opType === 'updateOne' || opType === 'updateMany') {\n\t\t\t\t\t// If this.timestamps is true, add updatedAt\n\t\t\t\t\tif (this.timestamps) {\n\t\t\t\t\t\tif (!doc.update.$set) {\n\t\t\t\t\t\t\tdoc.update.$set = {};\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdoc.update.$set.updatedAt = new Date();\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// If this.useVersions is true, increment __v\n\t\t\t\t\tif (!bypassVersions && this.useVersions) {\n\t\t\t\t\t\tif (!doc.update.$inc) {\n\t\t\t\t\t\t\tdoc.update.$inc = {};\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdoc.update.$inc.__v = 1;\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Prepare log entry\n\t\t\t\t\tif (!bypassLogs && this.createLogs) {\n\t\t\t\t\t\tlogs.push({\n\t\t\t\t\t\t\tinsertOne: {\n\t\t\t\t\t\t\t\tdocument: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: doc.filter._id || null,\n\t\t\t\t\t\t\t\t\tpayload:\n\t\t\t\t\t\t\t\t\t\tgetBinarySize(JSON.stringify(doc.update)) < 200000\n\t\t\t\t\t\t\t\t\t\t\t? JSON.stringify(doc.update, null, 2)\n\t\t\t\t\t\t\t\t\t\t\t: 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: opType,\n\t\t\t\t\t\t\t\t\tid_user: '', // Add user info if available\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date(),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// For versioning, store the filter to fetch the document later\n\t\t\t\t\tif (!bypassVersions && this.useVersions) {\n\t\t\t\t\t\tversionOps.push({\n\t\t\t\t\t\t\tfilter: doc.filter,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// No need to modify the operation further\n\t\t\t\t}\n\t\t\t\telse if (opType === 'replaceOne') {\n\t\t\t\t\t// If this.timestamps is true, set updatedAt\n\t\t\t\t\tif (this.timestamps) {\n\t\t\t\t\t\tdoc.replacement.updatedAt = new Date();\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// If this.useVersions is true, increment __v\n\t\t\t\t\tif (!bypassVersions && this.useVersions) {\n\t\t\t\t\t\tdoc.replacement.__v = (doc.replacement.__v || 0) + 1;\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Prepare log entry\n\t\t\t\t\tif (!bypassLogs && this.createLogs) {\n\t\t\t\t\t\tlogs.push({\n\t\t\t\t\t\t\tinsertOne: {\n\t\t\t\t\t\t\t\tdocument: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: doc.filter._id || null,\n\t\t\t\t\t\t\t\t\tpayload:\n\t\t\t\t\t\t\t\t\t\tgetBinarySize(JSON.stringify(doc.replacement)) < 200000\n\t\t\t\t\t\t\t\t\t\t\t? JSON.stringify(doc.replacement, null, 2)\n\t\t\t\t\t\t\t\t\t\t\t: 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\t\t\tid_user: '', // Add user info if available\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date(),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// For versioning, store the filter to fetch the document later\n\t\t\t\t\tif (!bypassVersions && this.useVersions) {\n\t\t\t\t\t\tversionOps.push({\n\t\t\t\t\t\t\tfilter: doc.filter,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Since we might have modified doc.replacement, update the operation\n\t\t\t\t\top[opType].replacement = doc.replacement;\n\t\t\t\t}\n\t\t\t\telse if (opType === 'deleteOne' || opType === 'deleteMany') {\n\t\t\t\t\t// Prepare log entry\n\t\t\t\t\tif (!bypassLogs && this.createLogs) {\n\t\t\t\t\t\tlogs.push({\n\t\t\t\t\t\t\tinsertOne: {\n\t\t\t\t\t\t\t\tdocument: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: doc.filter._id || null,\n\t\t\t\t\t\t\t\t\tpayload:\n\t\t\t\t\t\t\t\t\t\tgetBinarySize(JSON.stringify(doc.filter)) < 200000\n\t\t\t\t\t\t\t\t\t\t\t? JSON.stringify(doc.filter, null, 2)\n\t\t\t\t\t\t\t\t\t\t\t: 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: opType,\n\t\t\t\t\t\t\t\t\tid_user: '', // Add user info if available\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date(),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// For versioning, store the filter to fetch the document later\n\t\t\t\t\tif (!bypassVersions && this.useVersions) {\n\t\t\t\t\t\tversionOps.push({\n\t\t\t\t\t\t\tfilter: doc.filter,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// No need to modify the operation\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthrow new Error(`Unsupported operation type: ${opType}`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet affectedDocs = [];\n\t\n\t\t\t// Handle versioning\n\t\t\tif (!bypassVersions && this.useVersions && versionOps.length > 0) {\n\t\t\t\ttry {\n\t\t\t\t\t// Fetch the affected documents\n\t\t\t\t\tconst versionFilters = versionOps.map((v) => v.filter);\n\t\t\t\t\taffectedDocs = await ResolveIOServer.getMainDB().collection(this.collectionName).find({ $or: versionFilters }, sessionOptions).toArray();\n\t\t\n\t\t\t\t\t// Prepare version documents\n\t\t\t\t\tconst versionInserts = affectedDocs.map((doc) => ({\n\t\t\t\t\t\tinsertOne: {\n\t\t\t\t\t\t\tdocument: {\n\t\t\t\t\t\t\t\t...doc,\n\t\t\t\t\t\t\t\t_id: { _id: doc._id, __v: doc.__v },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t}));\n\t\t\n\t\t\t\t\t// Insert versions in bulk\n\t\t\t\t\tif (versionInserts.length > 0) {\n\t\t\t\t\t\tlet bwOptions = null;\n\t\t\t\t\t\tif (!sessionOptions) {\n\t\t\t\t\t\t\tbwOptions = {ordered: false};\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tbwOptions = {session: mongoSession, ordered: false};\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection(this.versionCollection).bulkWrite(<any>versionInserts, bwOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch(e) {\n\t\t\t\t\tconsole.error('Error during version creation:', e);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet { session, ...safeOptions } = options || {};\n\n\t\t\t// Execute bulkWrite\n\t\t\tconst monitor = MonitorMongo.create('bulkWrite', this.collectionName, JSON.stringify([batchOps, safeOptions]));\n\n\t\t\ttry {\n\t\t\t\tawait ResolveIOServer.getMainDB().collection(this.collectionName).bulkWrite(batchOps, options);\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\terr.message = `Error in Bulk Write: ${this.collectionName} - ${err.message}`;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tawait monitor.finish();\n\t\t\t}\n\t\n\t\t\t// Insert logs in bulk\n\t\t\tif (!bypassLogs && this.createLogs && logs.length > 0) {\n\t\t\t\tif (\n\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t) {\n\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLogs(logs.map(a => {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\tdata: a\n\t\t\t\t\t\t};\n\t\t\t\t\t}));\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tlet bwOptions = null;\n\t\t\t\t\tif (!sessionOptions) {\n\t\t\t\t\t\tbwOptions = {ordered: false};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tbwOptions = {session: mongoSession, ordered: false};\n\t\t\t\t\t}\n\n\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').bulkWrite(logs, bwOptions);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!bypassVersions && this.useVersions) {\n\t\t\t\t// Delete old versions beyond the latest 5\n\t\t\t\ttry {\n\t\t\t\t\tconst affectedDocIds = affectedDocs.map((doc) => doc._id);\n\t\n\t\t\t\t\tconst pipeline = [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$match: { '_id._id': { $in: affectedDocIds } },\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$sort: { '_id._id': 1, '_id.__v': -1 },\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$group: {\n\t\t\t\t\t\t\t\t_id: '$_id._id',\n\t\t\t\t\t\t\t\tversions: { $push: '$_id' },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$project: {\n\t\t\t\t\t\t\t\tversionsToDelete: { $slice: ['$versions', 5, { $size: '$versions' }] },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{ $unwind: '$versionsToDelete' },\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$replaceRoot: { newRoot: { _id: '$versionsToDelete' } },\n\t\t\t\t\t\t},\n\t\t\t\t\t];\n\t\n\t\t\t\t\tconst oldVersions = await ResolveIOServer.getMainDB().collection(this.versionCollection).aggregate(pipeline, sessionOptions).toArray();\n\t\n\t\t\t\t\tif (oldVersions.length > 0) {\n\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection(this.versionCollection).deleteMany({ _id: { $in: oldVersions.map((v) => v._id) } }, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch (error) {\n\t\t\t\t\tconsole.error('Error during version cleanup:', error);\n\t\t\t\t\t// Handle the error as needed\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\topIndex += BATCH_SIZE;\n\t\n\t\t\t// Yield to the event loop\n\t\t\t// eslint-disable-next-line no-restricted-syntax\n\t\t\tawait new Promise((resolve) => setImmediate(resolve));\n\t\n\t\t\t// Invalidate cache\n\t\t\tif (!this.skipCache) {\n\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t}\n\t\t}\n\t\n\t\treturn { ok: 1 } as BulkWriteResult; // Adjust return value as per your requirements\n\t}\n\n\tasync countDocuments(\n\t\tfilter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {},\n\t\toptions?: CountDocumentsOptions,\n\t\tskipCache = false, \n\t\tbypassSession = false\n\t): Promise<number> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\t\t\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\t// Check if the filter is empty\n\t\tconst isUnfiltered = Object.keys(filter).length === 0;\n\n\t\tif (isUnfiltered) {\n\t\t\t// Use collection stats for an unfiltered count\n\t\t\treturn ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).estimatedDocumentCount(options);\n\t\t}\n\t\telse if (!skipCache && !this.skipCache) {\n\t\t\t// Use cached count if skipCache is false\n\t\t\treturn ResolveIOServer.getMongoManager().countDocuments(this.collectionName, filter, options);\n\t\t}\n\t\telse {\n\t\t\t// Fallback to direct countDocuments call with monitoring if skipCache is true\n\n\t\t\tlet monitor = MonitorMongo.create('countDocuments', this.collectionName, JSON.stringify([filter, safeOptions]));\n\n\t\t\ttry {\n\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).countDocuments(<any>filter, options);\n\t\t\t\treturn res;\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tconsole.log(new Date(), 'Error Count Documents', this.collectionName, filter, safeOptions, err);\n\t\t\t\terr.message = `Error in Count Documents: ${this.collectionName} - ${err.message}`;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tawait monitor.finish();\n\t\t\t}\n\t\t}\n\t}\n\n\t//Helper Function (1 or Many) - Not Real Mongo Function\n\tcreate(f_docs: T | T[], options?: InsertOneOptions | BulkWriteOptions): Promise<T | T[]> {\n\t\tif (!Array.isArray(f_docs)) {\n\t\t\treturn this.insertOne(f_docs, <InsertOneOptions>options);\n\t\t}\n\t\telse if (f_docs.length === 1) {\n\t\t\treturn this.insertOne(f_docs[0], <InsertOneOptions>options);\n\t\t}\n\n\t\treturn this.insertMany(f_docs, <BulkWriteOptions>options);\n\t}\n\n\tasync createIndex(fieldOrSpec: any, options?: CreateIndexesOptions): Promise<string> {\n\t\ttry {\n\t\t\t// Check if index already exists based on the key\n\t\t\tconst dbCollection = ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions);\n\t\t\tconst existingIndexes = await dbCollection.indexes();\n\n\t\t\t// Check if an index with the same key already exists\n\t\t\tconst indexExists = existingIndexes.some(index => \n\t\t\t\tJSON.stringify(index.key) === JSON.stringify(fieldOrSpec)\n\t\t\t);\n\n\t\t\tif (indexExists) {\n\t\t\t\treturn 'Index already exists'; // Skip creation if index exists\n\t\t\t}\n\n\t\t\t// If index doesn't exist, push it to the queue\n\t\t\tMongoManagerCollection.indexQueue.push({\n\t\t\t\taction: 'createIndex',\n\t\t\t\tcollection: this,\n\t\t\t\tspecs: [fieldOrSpec],\n\t\t\t\toptions: options\n\t\t\t}, (error, result) => {\n\t\t\t\tif (error) throw error;\n\t\t\t\telse return result;\n\t\t\t});\n\n\t\t\treturn 'Index creation queued';\n\t\t} \n\t\tcatch (err) {\n\t\t\tthrow err;\n\t\t}\n\t}\n\t\n\tasync createIndexes(indexSpecs: IndexDescription[], options?: CreateIndexesOptions): Promise<string[]> {\n\t\ttry {\n\t\t\tconst dbCollection = ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions);\n\t\t\tconst existingIndexes = await dbCollection.indexes();\n\n\t\t\t// Filter out indexes that already exist based on the key\n\t\t\tconst indexesToCreate = indexSpecs.filter(indexSpec => \n\t\t\t\t!existingIndexes.some(existingIndex => \n\t\t\t\t\tJSON.stringify(existingIndex.key) === JSON.stringify(indexSpec.key)\n\t\t\t\t)\n\t\t\t);\n\n\t\t\t// If no new indexes to create, resolve early\n\t\t\tif (indexesToCreate.length === 0) {\n\t\t\t\treturn ['All indexes already exist'];\n\t\t\t}\n\n\t\t\t// Push only new indexes to the queue\n\t\t\tMongoManagerCollection.indexQueue.push({\n\t\t\t\taction: 'createIndexes',\n\t\t\t\tcollection: this,\n\t\t\t\tspecs: [indexesToCreate],\n\t\t\t\toptions: options\n\t\t\t}, (error, result) => {\n\t\t\t\tif (error) throw error;\n\t\t\t\telse return result;\n\t\t\t});\n\n\t\t\treturn ['Index creation queued'];\n\t\t} \n\t\tcatch (err) {\n\t\t\tthrow err;\n\t\t}\n\t}\n\t\n\tasync deleteMany(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {}, options?: DeleteOptions, bypassLogs = false, bypassSession = false): Promise<number> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\t\t\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tif ((this.createLogs && !bypassLogs) || this.useVersions) {\n\t\t\tlet docs = await this.find(filter);\n\n\t\t\tfor (let i = 0; i < docs.length; i++) {\n\t\t\t\tlet doc = docs[i];\n\t\t\t\n\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t) {\n\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, safeOptions])) < 200000 ? JSON.stringify([doc, filter, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'deleteMany',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, safeOptions])) < 200000 ? JSON.stringify([doc, filter, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\tmethod: 'deleteMany',\n\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.useVersions) {\n\t\t\t\t\tlet versionDoc = deepCopy(doc);\n\t\t\t\t\tversionDoc._id = {_id: doc._id, __v: doc.__v};\n\n\t\t\t\t\tlet versionOptions = null;\n\t\t\t\t\tif (!sessionOptions) {\n\t\t\t\t\t\tversionOptions = {upsert: true};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tversionOptions = {session: mongoSession, upsert: true};\n\t\t\t\t\t}\n\n\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, versionOptions);\n\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).deleteMany(<any>{$and: [{'_id._id': doc._id}, {'_id.__v': {$lt: doc.__v - 1}}]}, sessionOptions);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tlet monitor = MonitorMongo.create('deleteMany', this.collectionName, JSON.stringify([filter, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).deleteMany(<any>filter, options);\n\t\t\tif (res.acknowledged) {\n\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t}\n\t\t\t\treturn res.deletedCount;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new Error(`Error in DeleteMany: ${this.collectionName}`);\n\t\t\t}\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Delete Many', this.collectionName, filter, safeOptions, err);\n\t\t\terr.message = `Error in Delete Many: ${this.collectionName} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync deleteOne(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {}, options?: FindOneAndDeleteOptions, bypassLogs = false, bypassSession = false): Promise<number> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tif (this.createLogs && !bypassLogs) {\n\t\t\tlet monitor = MonitorMongo.create('findOneAndDelete', this.collectionName, JSON.stringify([filter, safeOptions]));\n\t\t\t\n\t\t\ttry {\n\t\t\t\tlet returnVal = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).findOneAndDelete(<any>filter, options);\n\t\t\t\tlet doc = returnVal.value;\n\n\t\t\t\tif (doc) {\n\t\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: doc._id as string,\n\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, safeOptions])) < 200000 ? JSON.stringify([doc, filter, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: 'deleteOne',\n\t\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: doc._id as string,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, safeOptions])) < 200000 ? JSON.stringify([doc, filter, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'deleteOne',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (this.useVersions) {\n\t\t\t\t\t\tlet versionDoc = deepCopy(doc);\n\t\t\t\t\t\tversionDoc._id = {_id: doc._id, __v: doc.__v};\n\n\t\t\t\t\t\tlet versionOptions = null;\n\t\t\t\t\t\tif (!sessionOptions) {\n\t\t\t\t\t\t\tversionOptions = {upsert: true};\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tversionOptions = {session, upsert: true};\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, versionOptions);\n\t\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).deleteMany(<any>{$and: [{'_id._id': doc._id}, {'_id.__v': {$lt: doc.__v - 1}}]}, sessionOptions);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tconsole.log(new Date(), 'Error Delete One (Find One And Delete)', this.collectionName, filter, safeOptions, err);\n\t\t\t\terr.message = `Error in Delete One (Find One And Delete): ${this.collectionName} - ${err.message}`;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tawait monitor.finish();\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tlet monitor = MonitorMongo.create('deleteOne', this.collectionName, JSON.stringify([filter, safeOptions]));\n\n\t\t\ttry {\n\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).deleteOne(<any>filter, options);\n\t\t\t\tif (res.acknowledged) {\n\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t}\n\t\t\t\t\treturn res.deletedCount;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthrow new Error(`Error in Delete One: ${this.collectionName}`);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tconsole.log(new Date(), 'Error Delete One', this.collectionName, filter, safeOptions, err);\n\t\t\t\terr.message = `Error in Delete One: ${this.collectionName} - ${err.message}`;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tawait monitor.finish();\n\t\t\t}\n\t\t}\n\t}\n\n\tasync distinct(key: string, filter?: MongoManagerFilter<T> & MongoManagerFilterOperators<T>, options?: CommandOperationOptions, bypassSession = false): Promise<T[]> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('distinct', this.collectionName, JSON.stringify([key, filter, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).distinct(key, <any>filter, options);\n\t\t\treturn res;\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Distinct', this.collectionName, filter, safeOptions, err);\n\t\t\terr.message = `Error in Distinct: ${this.collectionName} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync drop(options?: CommandOperationOptions, bypassSession = false): Promise<boolean> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('drop', this.collectionName, JSON.stringify([safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).drop(options);\n\t\t\treturn res;\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Count Documents', this.collectionName, safeOptions, err);\n\t\t\terr.message = `Error in Count Documents: ${this.collectionName} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync dropIndex(indexName: string, options?: CommandOperationOptions, bypassSession = false): Promise<Document> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('dropIndex', this.collectionName, JSON.stringify([indexName, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).dropIndex(indexName, options);\n\t\t\treturn <Document>res;\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Drop Index', this.collectionName, indexName, safeOptions, err);\n\t\t\terr.message = `Error in Drop Index: ${this.collectionName} - ${indexName} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync dropIndexes(options?: CommandOperationOptions, bypassSession = false): Promise<Document> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('dropIndexes', this.collectionName, JSON.stringify([safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).dropIndexes(options);\n\t\t\treturn res;\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Drop Indexes', this.collectionName, safeOptions, err);\n\t\t\terr.message = `Error in Drop Indexes: ${this.collectionName} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync find(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {}, options?: FindOptions<T>, skipCache = false, bypassSession = false): Promise<T[]> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tif (!skipCache && !this.skipCache) {\n\t\t\treturn ResolveIOServer.getMongoManager().find(this.collectionName, filter, options);\n\t\t}\n\t\telse {\n\t\t\tlet monitor = MonitorMongo.create('find', this.collectionName, JSON.stringify([filter, safeOptions]));\n\n\t\t\ttry {\n\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).find<T>(<any>filter, options).toArray();\n\t\t\t\treturn res;\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tconsole.log(new Date(), 'Error Find', this.collectionName, filter, safeOptions, err);\n\t\t\t\terr.message = `Error in Find: ${this.collectionName} - ${JSON.stringify(filter, null, 2)} - ${err.message}`;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tawait monitor.finish();\n\t\t\t}\n\t\t}\n\t}\n\n\tasync findById(id: string, options?: FindOptions<T>, skipCache = false, bypassSession = false): Promise<T> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tif (!skipCache && !this.skipCache) {\n\t\t\treturn ResolveIOServer.getMongoManager().findOne(this.collectionName, {_id: id}, options);\n\t\t}\n\t\telse {\n\t\t\tlet monitor = MonitorMongo.create('findById', this.collectionName, JSON.stringify([{_id: id}, safeOptions]));\n\t\t\t\n\t\t\ttry {\n\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).findOne<T>(<any>{_id: id}, options);\n\t\t\t\treturn res;\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tconsole.log(new Date(), 'Error Find By Id', this.collectionName, {_id: id}, safeOptions, err);\n\t\t\t\terr.message = `Error in Find By ID: ${this.collectionName} - ${id} - ${err.message}`;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tawait monitor.finish();\n\t\t\t}\n\t\t}\n\t}\n\n\tasync findCount(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {}, options?: FindOptions<T>, bypassSession = false): Promise<Number> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('findCount', this.collectionName, JSON.stringify([filter, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).find(<any>filter, options).count();\n\t\t\treturn res;\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Find Count', this.collectionName, filter, safeOptions, err);\n\t\t\terr.message = `Error in Find Count: ${this.collectionName} - ${JSON.stringify(filter, null, 2)} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tfindCursor(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {}, options?: FindOptions<T>, bypassSession = false): FindCursor {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\t\t\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('findCursor', this.collectionName, JSON.stringify([filter, safeOptions]));\n\t\tlet cursor = ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).find(<any>filter, options);\n\t\tcursor.on('close', async ev => {\n\t\t\tawait monitor.finish();\n\t\t\tcursor.removeAllListeners();\n\t\t\treturn ev;\n\t\t});\n\n\t\treturn cursor;\n\t}\n\n\tfindStream(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {}, options?: FindOptions<T>, streamOptions?: CursorStreamOptions, bypassSession = false) {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\t\t\n\t\tlet { session, ...safeOptions } = options || {};\n\t\t\n\t\tlet monitor = MonitorMongo.create('findStream', this.collectionName, JSON.stringify([filter, safeOptions, streamOptions]));\n\t\tlet stream = ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).find(<any>filter, options).stream(streamOptions).on('close', async ev => {\n\t\t\tawait monitor.finish();\n\t\t\treturn ev;\n\t\t});\n\n\t\treturn stream;\n\t}\n\n\tasync findOne(filter: MongoManagerFilter<T> | MongoManagerFilterOperators<T> = {}, options?: FindOptions<T>, skipCache = false, bypassSession = false): Promise<T> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\tif (!skipCache && !this.skipCache) {\n\t\t\treturn ResolveIOServer.getMongoManager().findOne(this.collectionName, filter, options);\n\t\t}\n\t\telse {\n\t\t\tlet { session, ...safeOptions } = options || {};\n\n\t\t\tlet monitor = MonitorMongo.create('findOne', this.collectionName, JSON.stringify([filter, safeOptions]));\n\t\t\t\n\t\t\ttry {\n\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).findOne<T>(<any>filter, options);\n\t\t\t\treturn res;\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tconsole.log(new Date(), 'Error Find One', this.collectionName, filter, safeOptions, err);\n\t\t\t\terr.message = `Error in Find One: ${this.collectionName} - ${JSON.stringify(filter, null, 2)} - ${err.message}`;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tawait monitor.finish();\n\t\t\t}\n\t\t}\n\t}\n\n\tasync findOneAndDelete(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {}, options?: FindOneAndDeleteOptions, bypassLogs = false, bypassSession = false): Promise<T> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('findOneAndDelete', this.collectionName, JSON.stringify([filter, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).findOneAndDelete(<any>filter, options);\n\t\t\tlet doc = res.value;\n\t\t\t\n\t\t\tif (doc) {\n\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t) {\n\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: doc._id as string,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, safeOptions])) < 200000 ? JSON.stringify([doc, filter, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'findOneAndDelete',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\tid_document: doc._id as string,\n\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, safeOptions])) < 200000 ? JSON.stringify([doc, filter, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\tmethod: 'findOneAndDelete',\n\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.useVersions) {\n\t\t\t\t\tlet versionDoc = deepCopy(doc);\n\t\t\t\t\tversionDoc._id = {_id: doc._id, __v: doc.__v};\n\n\t\t\t\t\tlet versionOptions = null;\n\t\t\t\t\tif (!sessionOptions) {\n\t\t\t\t\t\tversionOptions = {upsert: true};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tversionOptions = {session, upsert: true};\n\t\t\t\t\t}\n\n\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, versionOptions);\n\t\t\t\t}\n\n\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t}\n\n\t\t\t\treturn <T>doc;\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Find One And Delete', this.collectionName, filter, safeOptions, err);\n\t\t\terr.message = `Error in Find One And Delete: ${this.collectionName} - ${JSON.stringify(filter, null, 2)} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync findOneAndReplace(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {}, replacement: T, options?: FindOneAndReplaceOptions, bypassLogs = false, bypassCheckSchema = false, bypassSession = false): Promise<T> {\n\t\tif (this.checkSchema && !bypassCheckSchema) {\n\t\t\tconst validation = this.simplschema.newContext();\n\t\t\tconst isValid = validation.validate(replacement);\n\n\t\t\tif (!isValid) {\n\t\t\t\tconsole.log(new Date(), this.collectionName, 'Schema Errors - findOneAndReplace', validation.validationErrors());\n\t\t\t\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on findOneAndReplace - ' + this.collectionName, [validation.validationErrors(), replacement]);\n\t\t\t\t\n\t\t\t\tthrow validation.validationErrors();\n\t\t\t}\n\t\t}\n\t\t\n\t\tlet date = new Date();\n\n\t\tif (this.timestamps) {\n\t\t\treplacement.updatedAt = date;\n\t\t}\n\n\t\tif (options && options.upsert) {\n\t\t\tif (!replacement._id) {\n\t\t\t\treplacement._id = objectIdHexString();\n\t\t\t}\n\n\t\t\tif (this.useVersions) {\n\t\t\t\treplacement.__v = 0;\n\t\t\t}\n\n\t\t\tif (this.timestamps && !replacement.createdAt) {\n\t\t\t\treplacement.createdAt = date;\n\t\t\t}\n\t\t}\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('findOneAndReplace', this.collectionName, JSON.stringify([filter, replacement, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).findOneAndReplace(<any>filter, replacement, options);\n\t\t\tlet doc = res.value;\n\n\t\t\tif (doc) {\n\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t) {\n\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: doc._id as string,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, replacement, safeOptions])) < 200000 ? JSON.stringify([doc, filter, replacement, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'findOneAndReplace',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\tid_document: doc._id as string,\n\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, replacement, safeOptions])) < 200000 ? JSON.stringify([doc, filter, replacement, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\tmethod: 'findOneAndReplace',\n\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.useVersions) {\n\t\t\t\t\tlet versionDoc = deepCopy(doc);\n\t\t\t\t\tversionDoc._id = {_id: doc._id, __v: doc.__v};\n\n\t\t\t\t\tlet versionOptions = null;\n\t\t\t\t\tif (!sessionOptions) {\n\t\t\t\t\t\tversionOptions = {upsert: true};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tversionOptions = {session, upsert: true};\n\t\t\t\t\t}\n\n\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, versionOptions);\n\t\t\t\t}\n\n\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t}\n\n\t\t\t\treturn <T>doc;\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Find One And Replace', this.collectionName, filter, safeOptions, err);\n\t\t\terr.message = `Error in Find One And Replace: ${this.collectionName} - ${JSON.stringify(filter, null, 2)} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync findOneAndUpdate(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T> = {}, update: MongoManagerUpdateFilter<T>, options?: FindOneAndUpdateOptions, bypassLogs = false, bypassCheckSchema = false, bypassSession = false): Promise<T> {\n\t\tif (this.checkSchema && !bypassCheckSchema) {\n\t\t\tconst validation = this.simplschema.newContext();\n\t\t\tconst isValid = validation.validate(update, {modifier: true});\n\n\t\t\tif (!isValid) {\n\t\t\t\tconsole.log(new Date(), this.collectionName, 'Schema Errors - findOneAndUpdate', validation.validationErrors());\n\t\t\t\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on findOneAndUpdate - ' + this.collectionName, [validation.validationErrors(), update]);\n\t\t\t\tthrow validation.validationErrors();\n\t\t\t}\n\t\t}\n\n\t\tif (this.timestamps) {\n\t\t\tlet date = new Date(); \n\t\t\t\n\t\t\tif (!update.$set) {\n\t\t\t\tupdate.$set = <any>{updatedAt: date};\n\t\t\t}\n\t\t\telse {\n\t\t\t\tupdate.$set.updatedAt = date;\n\t\t\t}\n\t\t}\n\n\t\tif (options && options.upsert) {\n\t\t\tif (!update.$setOnInsert) {\n\t\t\t\tif (this.timestamps) {\n\t\t\t\t\tupdate.$setOnInsert = <any>{\n\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tupdate.$setOnInsert = <any>{\n\t\t\t\t\t\t_id: objectIdHexString()\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (!update.$setOnInsert._id) {\n\t\t\t\t\tupdate.$setOnInsert._id = objectIdHexString();\n\t\t\t\t}\n\n\t\t\t\tif (this.timestamps && !update.$setOnInsert.createdAt) {\n\t\t\t\t\tupdate.$setOnInsert.createdAt = new Date();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('findOneAndUpdate', this.collectionName, JSON.stringify([filter, update, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).findOneAndUpdate(<any>filter, <any>update, options);\n\t\t\tlet doc = res.value;\n\n\t\t\tif (doc) {\n\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t) {\t\n\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: <string>doc._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, update, safeOptions])) < 200000 ? JSON.stringify([doc, filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'findOneAndUpdate',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\tid_document: <string>doc._id,\n\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, update, safeOptions])) < 200000 ? JSON.stringify([doc, filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\tmethod: 'findOneAndUpdate',\n\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.useVersions) {\n\t\t\t\t\tlet versionDoc = deepCopy(doc);\n\t\t\t\t\tversionDoc._id = {_id: doc._id, __v: doc.__v};\n\n\t\t\t\t\tlet versionOptions = null;\n\t\t\t\t\tif (!sessionOptions) {\n\t\t\t\t\t\tversionOptions = {upsert: true};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tversionOptions = {session, upsert: true};\n\t\t\t\t\t}\n\n\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, versionOptions);\n\t\t\t\t}\n\n\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\treturn <T>doc;\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Find One And Update', this.collectionName, filter, safeOptions, err);\n\t\t\terr.message = `Error in Find One And Update: ${this.collectionName} - ${JSON.stringify(filter, null, 2)} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync indexes(options: IndexInformationOptions, bypassSession = false): Promise<any[]> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('indexes', this.collectionName, JSON.stringify([safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).indexes(options);\n\t\t\treturn res;\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Indexes', this.collectionName, safeOptions, err);\n\t\t\terr.message = `Error in Indexes: ${this.collectionName} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync indexExists(indexes: string | string[], options?: IndexInformationOptions, bypassSession = false): Promise<boolean> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('indexExists', this.collectionName, JSON.stringify([indexes, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).indexExists(indexes, options);\n\t\t\treturn res;\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Index Exists', this.collectionName, indexes, safeOptions, err);\n\t\t\terr.message = `Error in Index Exists: ${this.collectionName} - ${JSON.stringify(indexes, null, 2)} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync insertMany(docs: T[], options?: BulkWriteOptions, bypassLogs = false, bypassCheckSchema = false, bypassMonitor = false, bypassSession = false): Promise<T[]> {\n\t\tif (!docs.length) {\n\t\t\treturn [];\n\t\t}\n\t\t\n\t\tlet validationResults = [];\n\n\t\tif (this.checkSchema && !bypassCheckSchema) {\n\t\t\tdocs.forEach(doc => {\n\t\t\t\tconst validation = this.simplschema.newContext();\n\t\t\t\tconst isValid = validation.validate(doc);\n\n\t\t\t\tif (!isValid) {\n\t\t\t\t\tconsole.log(new Date(), this.collectionName, 'Schema Errors - insertMany', validation.validationErrors());\n\t\t\t\t\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on insertMany - ' + this.collectionName, [validation.validationErrors(), doc]);\n\t\t\t\t\tvalidationResults.push(false);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tvalidationResults.push(true);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tlet validDocs = this.checkSchema ? docs.filter((a, idx) => validationResults[idx]) : docs;\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tfor (let i = 0; i < validDocs.length; i++) {\n\t\t\tlet doc = validDocs[i];\n\n\t\t\tif (!doc._id) {\n\t\t\t\tdoc._id = objectIdHexString();\n\t\t\t}\n\n\t\t\tif (this.timestamps) {\n\t\t\t\tlet date = new Date();\n\n\t\t\t\tif (!doc.createdAt) {\n\t\t\t\t\tdoc.createdAt = date;\n\t\t\t\t}\n\n\t\t\t\tif (!doc.updatedAt) {\n\t\t\t\t\tdoc.updatedAt = date;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.useVersions && !doc.hasOwnProperty('__v')) {\n\t\t\t\tdoc.__v = 0;\n\t\t\t}\n\n\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\tif (\n\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t) {\n\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, safeOptions])) < 200000 ? JSON.stringify([doc, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\tmethod: 'insertMany',\n\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, safeOptions])) < 200000 ? JSON.stringify([doc, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\tmethod: 'insertMany',\n\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\troute: '',\n\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t}, sessionOptions);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (validDocs.length) {\n\t\t\tlet monitor = null;\n\t\t\t\n\t\t\tif (!bypassMonitor) {\n\t\t\t\tmonitor = MonitorMongo.create('insertMany', this.collectionName, JSON.stringify([validDocs, safeOptions]));\n\t\t\t}\n\t\t\t\n\t\t\ttry {\n\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).insertMany(<OptionalUnlessRequiredId<T>[]>validDocs, options);\n\n\t\t\t\tif (res.acknowledged) {\n\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t}\n\t\t\t\t\treturn validDocs;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthrow new Error(`Error in Insert Many: ${this.collectionName} - ${JSON.stringify(res, null, 2)}`);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tconsole.log(new Date(), 'Error Insert Many', this.collectionName, validDocs, safeOptions, err);\n\t\t\t\terr.message = `Error in Insert Many: ${this.collectionName} - ${err.message}`;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tif (monitor) {\n\t\t\t\t\tmonitor.finish();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn [];\n\t}\n\n\tasync insertOne(doc: T, options?: InsertOneOptions, bypassLogs = false, bypassCheckSchema = false, bypassSession = false): Promise<T> {\n\t\tif (!doc._id) {\n\t\t\tdoc._id = objectIdHexString();\n\t\t}\n\n\t\tif (this.checkSchema && !bypassCheckSchema) {\n\t\t\tconst validation = this.simplschema.newContext();\n\t\t\tconst isValid = validation.validate(doc);\n\n\t\t\tif (!isValid) {\n\t\t\t\tconsole.log(new Date(), this.collectionName, 'Schema Errors - insertOne', validation.validationErrors());\n\t\t\t\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on insertOne - ' + this.collectionName, [validation.validationErrors(), doc]);\n\t\t\t\tthrow validation.validationErrors();\n\t\t\t}\n\t\t}\n\n\t\tif (this.timestamps) {\n\t\t\tlet date = new Date();\n\t\t\n\t\t\tif (!doc.createdAt) {\n\t\t\t\tdoc.createdAt = date;\n\t\t\t}\n\n\t\t\tif (!doc.updatedAt) {\n\t\t\t\tdoc.updatedAt = date;\n\t\t\t}\n\t\t}\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tif (this.createLogs && !bypassLogs) {\n\t\t\tif (\n\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t) {\n\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\ttype: 'log',\n\t\t\t\t\tdata: {\n\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, safeOptions])) < 200000 ? JSON.stringify([doc, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\tmethod: 'insertOne',\n\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\troute: '',\n\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\telse {\n\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\ttype: 'document',\n\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, safeOptions])) < 200000 ? JSON.stringify([doc, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\tmethod: 'insertOne',\n\t\t\t\t\tid_user: '',\n\t\t\t\t\tuser: '',\n\t\t\t\t\tmessageId: 0,\n\t\t\t\t\troute: '',\n\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t}, sessionOptions);\n\t\t\t}\n\t\t}\n\n\t\tif (this.useVersions && !doc.hasOwnProperty('__v')) {\n\t\t\tdoc.__v = 0;\n\t\t}\n\n\t\tlet monitor = MonitorMongo.create('insertOne', this.collectionName, JSON.stringify([doc, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).insertOne(<OptionalUnlessRequiredId<T>>doc, options);\n\t\t\tif (res.acknowledged) {\n\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t}\n\t\t\t\treturn doc;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new Error(`Error in Insert One: ${this.collectionName} - ${JSON.stringify(res, null, 2)}`);\n\t\t\t}\n\t\t}\n\t\tcatch(err) {\n\t\t\tconsole.log(new Date(), 'Error Insert One', this.collectionName, doc, safeOptions, err);\n\t\t\terr.message = `Error in Insert One: ${this.collectionName} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tlistIndexes(options?: ListIndexesOptions, bypassSession = false): ListIndexesCursor {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\t\t\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('listIndexes', this.collectionName, JSON.stringify([safeOptions]));\n\t\tlet cursor = ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).listIndexes(options);\n\t\tcursor.on('close', async ev => {\n\t\t\tawait monitor.finish();\n\t\t\treturn ev;\n\t\t});\n\n\t\treturn cursor;\n\t}\n\n\tasync rename(newName: string, options?: RenameOptions, bypassSession = false): Promise<Collection<Document>> {\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {\n\t\t\t\t\tsession: mongoSession\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tlet monitor = MonitorMongo.create('rename', this.collectionName, JSON.stringify([newName, safeOptions]));\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).rename(newName, options);\n\t\t\treturn res;\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Rename', this.collectionName, newName, safeOptions, err);\n\t\t\terr.message = `Error in Rename: ${this.collectionName} - ${newName} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync replaceOne(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T>, replacement: T, options?: ReplaceOptions, bypassLogs = false, bypassCheckSchema = false, doc: T = null, bypassSession = false) : Promise<number> {\n\t\tif (this.checkSchema && !bypassCheckSchema) {\n\t\t\tconst validation = this.simplschema.newContext();\n\t\t\tconst isValid = validation.validate(replacement);\n\n\t\t\tif (!isValid) {\n\t\t\t\tconsole.log(new Date(), this.collectionName, 'Schema Errors - replaceOne', validation.validationErrors());\n\t\t\t\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on replaceOne - ' + this.collectionName, [validation.validationErrors(), replacement]);\n\t\t\t\tthrow validation.validationErrors();\n\t\t\t}\n\t\t}\n\t\t\n\t\tlet date = new Date();\n\t\t\n\t\tif (this.timestamps) {\n\t\t\treplacement.updatedAt = date;\n\t\t}\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tif (this.useVersions) {\n\t\t\tif (!doc) {\n\t\t\t\tdoc = await this.findOne(<any>filter, null, true);\n\t\t\t}\n\n\t\t\tif (doc) {\n\t\t\t\tif (this.timestamps && !replacement.createdAt && doc.createdAt) {\n\t\t\t\t\treplacement.createdAt = doc.createdAt;\n\t\t\t\t}\n\n\t\t\t\tif (doc.__v === replacement.__v) {\n\t\t\t\t\treplacement.__v += 1;\n\n\t\t\t\t\tlet versionDoc = deepCopy(doc);\n\t\t\t\t\tversionDoc._id = {_id: doc._id, __v: doc.__v};\n\n\t\t\t\t\tlet versionOptions = null;\n\t\t\t\t\tif (!sessionOptions) {\n\t\t\t\t\t\tversionOptions = {upsert: true};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tversionOptions = {session, upsert: true};\n\t\t\t\t\t}\n\n\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, versionOptions);\n\n\t\t\t\t\tif (doc.__v >= 4) {\n\t\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).deleteMany(<any>{$and: [{'_id._id': doc._id}, {'_id.__v': {$lt: doc.__v - 4}}]}, sessionOptions);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, replacement, safeOptions])) < 200000 ? JSON.stringify([doc, filter, replacement, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, replacement, safeOptions])) < 200000 ? JSON.stringify([doc, filter, replacement, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tlet monitor = MonitorMongo.create('replaceOne', this.collectionName, JSON.stringify([filter, replacement, safeOptions]));\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).replaceOne(<any>filter, replacement, options);\n\t\t\t\t\t\tif (res.acknowledged) {\n\t\t\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn res.modifiedCount;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tthrow new Error(`Error in Replace One: ${this.collectionName} - ${JSON.stringify(res, null, 2)}`);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcatch (err) {\n\t\t\t\t\t\tconsole.log(new Date(), 'Error Replace One', this.collectionName, filter, replacement, safeOptions, err);\n\t\t\t\t\t\terr.message = `Error in Replace One: ${this.collectionName} - ${err.message}`;\n\t\t\t\t\t\tthrow err;\n\t\t\t\t\t}\n\t\t\t\t\tfinally {\n\t\t\t\t\t\tawait monitor.finish();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tconsole.log('invalid version - ' + this.collectionName, doc.__v, replacement.__v);\n\n\t\t\t\t\tlet prevDoc = await ResolveIOServer.getMongoManager().collection(this.versionCollection).findOne({\n\t\t\t\t\t\t_id: <any>{\n\t\t\t\t\t\t\t_id: doc._id,\n\t\t\t\t\t\t\t__v: replacement.__v\n\t\t\t\t\t\t}\n\t\t\t\t\t}, null, true);\n\n\t\t\t\t\tif (prevDoc) {\n\t\t\t\t\t\tlet docId = doc._id;\n\t\t\t\t\t\tlet docVersion = doc.__v;\n\t\t\t\t\t\tlet updatedDoc: T = getMongoMergeUpdatedDoc(replacement, doc, prevDoc);\n\t\t\t\t\t\tupdatedDoc._id = docId;\n\t\t\t\t\t\tupdatedDoc.__v = docVersion + 1;\n\n\t\t\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\t\tid_document: docId,\n\t\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['invalidVersion - merge', doc, filter, updatedDoc, safeOptions])) < 200000 ? JSON.stringify(['invalidVersion - merge', doc, filter, updatedDoc, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: docId,\n\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['invalidVersion - merge', doc, filter, updatedDoc, safeOptions])) < 200000 ? JSON.stringify(['invalidVersion - merge', doc, filter, updatedDoc, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlet monitor = MonitorMongo.create('replaceOne', this.collectionName, JSON.stringify([filter, updatedDoc, safeOptions]));\n\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).replaceOne(<any>filter, updatedDoc, options);\n\t\t\t\t\t\t\tif (res.acknowledged) {\n\t\t\t\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn res.modifiedCount;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tthrow new Error(`Error in Replace One: ${this.collectionName} - ${JSON.stringify(res, null, 2)}`);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch (err) {\n\t\t\t\t\t\t\tconsole.log(new Date(), 'Error Replace One', this.collectionName, filter, updatedDoc, safeOptions, err);\n\t\t\t\t\t\t\terr.message = `Error in Replace One: ${this.collectionName} - ${err.message}`;\n\t\t\t\t\t\t\tthrow err;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfinally {\n\t\t\t\t\t\t\tawait monitor.finish();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tthrow new Error('Error in Replcae One: Invalid Version And Could Not Find History - DB: ' + doc.__v + ', Trying to update with :' + replacement.__v);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (options && options.upsert) {\n\t\t\t\tif (this.timestamps) {\n\t\t\t\t\treplacement.createdAt = date;\n\t\t\t\t}\n\n\t\t\t\tif (!replacement._id) {\n\t\t\t\t\treplacement._id = objectIdHexString();\n\t\t\t\t}\n\n\t\t\t\treplacement.__v = 0;\n\n\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t) {\n\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: replacement._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['upsert', filter, replacement, safeOptions])) < 200000 ? JSON.stringify(['upsert', filter, replacement, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\tid_document: replacement._id,\n\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['upsert', filter, replacement, safeOptions])) < 200000 ? JSON.stringify(['upsert', filter, replacement, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tlet monitor = MonitorMongo.create('replaceOne', this.collectionName, JSON.stringify([filter, replacement, safeOptions]));\n\n\t\t\t\ttry {\n\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).replaceOne(<any>filter, replacement, options);\n\t\t\t\t\tif (res.acknowledged) {\n\t\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn res.modifiedCount;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tthrow new Error(`Error in Replace One: ${this.collectionName} - ${JSON.stringify(res, null, 2)}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(new Date(), 'Error Replace One', this.collectionName, filter, replacement, safeOptions, err);\n\t\t\t\t\terr.message = `Error in Replace One: ${this.collectionName} - ${err.message}`;\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t\tfinally {\n\t\t\t\t\tawait monitor.finish();\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new Error('Error in Replace One: No Document');\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tif (options && options.upsert) {\n\t\t\t\tif (this.timestamps && !replacement.createdAt) {\n\t\t\t\t\treplacement.createdAt = date;\n\t\t\t\t}\n\n\t\t\t\tif (!replacement._id) {\n\t\t\t\t\treplacement._id = objectIdHexString();\n\t\t\t\t}\n\n\t\t\t\treplacement.__v = 0;\n\t\t\t}\n\n\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\tif (!options) {\n\t\t\t\t\toptions = <FindOneAndReplaceOptions>{returnDocument: 'before'};\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t(<FindOneAndReplaceOptions>options).returnDocument = 'before';\n\t\t\t\t}\n\n\t\t\t\tlet { session, ...safeOptions } = options || {};\n\n\t\t\t\tlet monitor = MonitorMongo.create('findOneAndReplace', this.collectionName, JSON.stringify([filter, replacement, safeOptions]));\n\n\t\t\t\ttry {\n\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).findOneAndReplace(<any>filter, replacement, <FindOneAndReplaceOptions>options);\n\t\t\t\t\tlet doc = res.value;\n\n\t\t\t\t\tif (doc) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: <string>doc._id,\n\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, replacement, safeOptions])) < 200000 ? JSON.stringify([doc, filter, replacement, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: <string>doc._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, replacement, safeOptions])) < 200000 ? JSON.stringify([doc, filter, replacement, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: replacement._id,\n\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['upsert', filter, replacement, safeOptions])) < 200000 ? JSON.stringify(['upsert', filter, replacement, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: replacement._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['upsert', filter, replacement, safeOptions])) < 200000 ? JSON.stringify(['upsert', filter, replacement, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'replaceOne',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(new Date(), 'Error Replace One (Find One And Replace)', this.collectionName, filter, replacement, safeOptions, err);\n\t\t\t\t\terr.message = `Error in Replace One (Find One And Replace): ${this.collectionName} - ${err.message}`;\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t\tfinally {\n\t\t\t\t\tawait monitor.finish();\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tlet monitor = MonitorMongo.create('replaceOne', this.collectionName, JSON.stringify([filter, replacement, safeOptions]));\n\n\t\t\t\ttry {\n\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).replaceOne(<any>filter, replacement, options);\n\t\t\t\t\tif (res.acknowledged) {\n\t\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn res.modifiedCount;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\treturn res.acknowledged;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(new Date(), 'Error Replace One', this.collectionName, filter, replacement, safeOptions, err);\n\t\t\t\t\terr.message = `Error in Aggregate: ${this.collectionName} - ${err.message}`;\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t\tfinally {\n\t\t\t\t\tawait monitor.finish();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tasync updateMany(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T>, update: MongoManagerUpdateFilter<T>, options?: UpdateOptions, bypassLogs = false, bypassCheckSchema = false, bypassVersions = false, bypassSession = false) : Promise<number> {\n\t\tif ((!update.$inc || JSON.stringify(update.$inc) === '{}') && (!update.$set || JSON.stringify(update.$set) === '{}') && (!update.$setOnInsert || JSON.stringify(update.$setOnInsert) === '{}') && (!update.$unset || JSON.stringify(update.$unset) === '{}')) {\n\t\t\treturn 1;\n\t\t}\n\t\t\n\t\tif (this.timestamps) {\n\t\t\tlet date = new Date();\n\n\t\t\tif (!update.$set) {\n\t\t\t\tupdate.$set = <any>{updatedAt: date};\n\t\t\t}\n\t\t\telse {\n\t\t\t\tupdate.$set.updatedAt = date;\n\t\t\t}\n\t\t}\n\n\t\tif (this.checkSchema && !bypassCheckSchema) {\n\t\t\tconst validation = this.simplschema.newContext();\n\t\t\tconst isValid = validation.validate(update, {modifier: true});\n\n\t\t\tif (!isValid) {\n\t\t\t\tconsole.log(new Date(), this.collectionName, 'Schema Errors - updateMany', validation.validationErrors());\n\t\t\t\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on updateMany - ' + this.collectionName, [validation.validationErrors(), update]);\n\t\t\t\tthrow validation.validationErrors();\n\t\t\t}\n\t\t}\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\n\t\tif ((this.useVersions && !bypassVersions) || (this.createLogs && !bypassLogs)) {\n\t\t\tlet docs = await this.find(filter);\n\n\t\t\tfor (let i = 0; i < docs.length; i++) {\n\t\t\t\tlet doc = docs[i];\n\n\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t) {\n\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, update, safeOptions])) < 200000 ? JSON.stringify([doc, filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'updateMany',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, update, safeOptions])) < 200000 ? JSON.stringify([doc, filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\tmethod: 'updateMany',\n\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.useVersions) {\n\t\t\t\t\tlet versionDoc = deepCopy(doc);\n\t\t\t\t\tversionDoc._id = {_id: doc._id, __v: doc.__v};\n\n\t\t\t\t\tlet versionOptions = null;\n\t\t\t\t\tif (!sessionOptions) {\n\t\t\t\t\t\tversionOptions = {upsert: true};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tversionOptions = {session, upsert: true};\n\t\t\t\t\t}\n\t\n\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, versionOptions);\n\t\t\t\t\t\n\t\t\t\t\tif (doc.__v >= 4) {\n\t\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).deleteMany(<any>{$and: [{'_id._id': doc._id}, {'_id.__v': {$lt: doc.__v - 4}}]}, sessionOptions);\n\t\t\t\t\t}\n\t\n\t\t\t\t\tif (!objectContainsPropertyDeep(update, '__v')) {\n\t\t\t\t\t\tif (!update.$inc) {\n\t\t\t\t\t\t\tupdate.$inc = {__v: 1};\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (!update.$inc.__v) {\n\t\t\t\t\t\t\tupdate.$inc.__v = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tlet monitor = MonitorMongo.create('updateMany', this.collectionName, JSON.stringify([filter, update, safeOptions]));\n\n\t\ttry {\n\t\t\tlet res = await ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateMany(<any>filter, update, options);\n\t\t\tif (res.acknowledged) {\n\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t}\n\n\t\t\t\treturn res.modifiedCount;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow res.acknowledged;\n\t\t\t}\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(new Date(), 'Error Update Many', this.collectionName, filter, update, safeOptions, err);\n\t\t\terr.message = `Error in Update Many: ${this.collectionName} - ${err.message}`;\n\t\t\tthrow err;\n\t\t}\n\t\tfinally {\n\t\t\tawait monitor.finish();\n\t\t}\n\t}\n\n\tasync updateOne(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T>, update: MongoManagerUpdateFilter<T>, options?: UpdateOptions, bypassLogs = false, bypassCheckSchema = false, bypassSession = false) : Promise<number> {\n\t\tif (this.checkSchema && !bypassCheckSchema) {\n\t\t\tconst validation = this.simplschema.newContext();\t\t\t\n\t\t\tconst isValid = validation.validate(update, {modifier: true});\n\n\t\t\tif (!isValid) {\n\t\t\t\tconsole.log(new Date(), this.collectionName, 'Schema Errors - updateOne', validation.validationErrors());\n\t\t\t\tResolveIOServer.getMainServer().getMethodManager().callMethod.call(ResolveIOServer.getMainServer().getMethodManager(), 'insertErrorLog', 'Schema Failed on updateOne - ' + this.collectionName, [validation.validationErrors(), update]);\n\t\t\t\tthrow validation.validationErrors();\n\t\t\t}\n\t\t}\n\n\t\tif ((!update.$inc || JSON.stringify(update.$inc) === '{}') && (!update.$set || JSON.stringify(update.$set) === '{}') && (!update.$setOnInsert || JSON.stringify(update.$setOnInsert) === '{}') && (!update.$unset || JSON.stringify(update.$unset) === '{}')) {\n\t\t\treturn 1;\n\t\t}\n\n\t\tlet date = new Date();\n\n\t\tif (this.timestamps) {\n\t\t\tif (!update.$set) {\n\t\t\t\tupdate.$set = <any>{updatedAt: date};\n\t\t\t}\n\t\t\telse {\n\t\t\t\tupdate.$set.updatedAt = date;\n\t\t\t}\n\t\t}\n\n\t\tconst mongoSession = ResolveIOServer.getMongoManager().getSession();\n\t\tlet sessionOptions = null;\n\t\tif (mongoSession && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session: mongoSession};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = mongoSession;\n\t\t\t}\n\n\t\t\tsessionOptions = {session: mongoSession};\n\t\t}\n\n\t\tlet { session, ...safeOptions } = options || {};\n\t\t\n\t\tif (this.useVersions) {\n\t\t\tlet doc = await this.findOne(filter, null, true);\n\n\t\t\tif (doc) {\n\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t) {\n\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, update, safeOptions])) < 200000 ? JSON.stringify([doc, filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'updateOne',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\tid_document: doc._id,\n\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, update, safeOptions])) < 200000 ? JSON.stringify([doc, filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\tmethod: 'updateOne',\n\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tlet versionDoc = deepCopy(doc);\n\t\t\t\tversionDoc._id = {_id: doc._id, __v: doc.__v};\n\n\t\t\t\tlet versionOptions = null;\n\t\t\t\tif (!sessionOptions) {\n\t\t\t\t\tversionOptions = {upsert: true};\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tversionOptions = {session, upsert: true};\n\t\t\t\t}\n\n\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne(<any>{_id: { _id: doc._id, __v: doc.__v}}, versionDoc, versionOptions);\n\t\t\t\t\n\t\t\t\tif (doc.__v >= 4) {\n\t\t\t\t\tawait ResolveIOServer.getMongoManager().collection(this.versionCollection).deleteMany(<any>{$and: [{'_id._id': doc._id}, {'_id.__v': {$lt: doc.__v - 4}}]}, sessionOptions);\n\t\t\t\t}\n\n\t\t\t\tif (!objectContainsPropertyDeep(update, '__v')) {\n\t\t\t\t\tif (!update.$inc) {\n\t\t\t\t\t\tupdate.$inc = {__v: 1};\n\t\t\t\t\t}\n\t\t\t\t\telse if (!update.$inc.__v) {\n\t\t\t\t\t\tupdate.$inc.__v = 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tlet monitor = MonitorMongo.create('updateOne', this.collectionName, JSON.stringify([filter, update, safeOptions]));\n\n\t\t\t\ttry {\n\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateOne(<any>filter, update, options);\n\t\t\t\t\tif (res.acknowledged) {\n\t\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn res.modifiedCount;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tthrow new Error(`Error in Update One: ${this.collectionName} - ${JSON.stringify(res, null, 2)}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(new Date(), 'Error Update One', this.collectionName, filter, update, safeOptions, err);\n\t\t\t\t\terr.message = `Error in Update One: ${this.collectionName} - ${err.message}`;\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t\tfinally {\n\t\t\t\t\tawait monitor.finish();\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (options && options.upsert) {\n\t\t\t\tif (!update.$setOnInsert) {\n\t\t\t\t\tif (this.timestamps) {\n\t\t\t\t\t\tupdate.$setOnInsert = <any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t__v: 0,\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tupdate.$setOnInsert = <any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t__v: 0\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (!update.$setOnInsert._id) {\n\t\t\t\t\t\tupdate.$setOnInsert._id = objectIdHexString();\n\t\t\t\t\t}\n\n\t\t\t\t\tif (this.timestamps && !update.$setOnInsert.createdAt) {\n\t\t\t\t\t\tupdate.$setOnInsert.createdAt = new Date();\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t) {\n\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: update.$setOnInsert._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['upsert', filter, update, safeOptions])) < 200000 ? JSON.stringify(['upsert', filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'updateOne',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\tid_document: update.$setOnInsert._id,\n\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['upsert', filter, update, safeOptions])) < 200000 ? JSON.stringify(['upsert', filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\tmethod: 'updateOne',\n\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tlet monitor = MonitorMongo.create('updateOne', this.collectionName, JSON.stringify([filter, update, safeOptions]));\n\n\t\t\t\ttry {\n\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateOne(<any>filter, update, options);\n\t\t\t\t\tif (res.acknowledged) {\n\t\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn res.modifiedCount;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tthrow new Error(`Error in Update One: ${this.collectionName} - ${JSON.stringify(res, null, 2)}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(new Date(), 'Error Update One', this.collectionName, filter, update, safeOptions, err);\n\t\t\t\t\terr.message = `Error in Update One: ${this.collectionName} - ${err.message}`;\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t\tfinally {\n\t\t\t\t\tawait monitor.finish();\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new Error('Error in Update One: No Document');\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tif (options && options.upsert) {\n\t\t\t\tif (!update.$setOnInsert) {\n\t\t\t\t\tif (this.timestamps) {\n\t\t\t\t\t\tupdate.$setOnInsert = <any>{\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tupdate.$setOnInsert = <any>{\n\t\t\t\t\t\t\t_id: objectIdHexString()\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (!update.$setOnInsert._id) {\n\t\t\t\t\t\tupdate.$setOnInsert._id = objectIdHexString();\n\t\t\t\t\t}\n\n\t\t\t\t\tif (this.timestamps && !update.$setOnInsert.createdAt) {\n\t\t\t\t\t\tupdate.$setOnInsert.createdAt = new Date();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.createLogs && !bypassLogs) {\n\t\t\t\tif (!options) {\n\t\t\t\t\toptions = <FindOneAndUpdateOptions>{returnDocument: 'before'};\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t(<FindOneAndUpdateOptions>options).returnDocument = 'before';\n\t\t\t\t}\n\n\t\t\t\tlet monitor = MonitorMongo.create('findOneAndUpdate', this.collectionName, JSON.stringify([filter, update, safeOptions]));\n\n\t\t\t\ttry {\n\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).findOneAndUpdate(<any>filter, update, <FindOneAndUpdateOptions>options);\n\t\t\t\t\tlet doc = res.value;\n\n\t\t\t\t\tif (doc) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: <any>doc._id,\n\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, update, safeOptions])) < 200000 ? JSON.stringify([doc, filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: 'updateOne',\n\t\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: <any>doc._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([doc, filter, update, safeOptions])) < 200000 ? JSON.stringify([doc, filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'updateOne',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t}, sessionOptions);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn res.ok;\n\t\t\t\t\t}\n\t\t\t\t\telse if (update.$setOnInsert) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tResolveIOServer.getServerConfig()['ROOT_URL'] !== 'https://resolveio.com'\n\t\t\t\t\t\t&& ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tResolveIOServer.getLocalLogManager().writeLog({\n\t\t\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\t\tid_document: update.$setOnInsert._id,\n\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['upsert', filter, update, safeOptions])) < 200000 ? JSON.stringify(['upsert', filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\t\tmethod: 'updateOne',\n\t\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tawait ResolveIOServer.getMainDB().collection('logs').insertOne(<any>{\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\ttype: 'document',\n\t\t\t\t\t\t\t\tcollection: this.collectionName,\n\t\t\t\t\t\t\t\tid_document: update.$setOnInsert._id,\n\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify(['upsert', filter, update, safeOptions])) < 200000 ? JSON.stringify(['upsert', filter, update, safeOptions], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\tmethod: 'updateOne',\n\t\t\t\t\t\t\t\tid_user: '',\n\t\t\t\t\t\t\t\tuser: '',\n\t\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\t\troute: '',\n\t\t\t\t\t\t\t\tcreatedAt: new Date()\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn res.ok;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(new Date(), 'Error Update One (Find One And Update)', this.collectionName, filter, update, safeOptions, err);\n\t\t\t\t\terr.message = `Error in Update One (Find One And Update): ${this.collectionName} - ${err.message}`;\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t\tfinally {\n\t\t\t\t\tawait monitor.finish();\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tlet monitor = MonitorMongo.create('updateOne', this.collectionName, JSON.stringify([filter, update, safeOptions]));\n\n\t\t\t\ttry {\n\t\t\t\t\tlet res = await ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateOne(<any>filter, update, options);\n\t\t\t\t\tif (res.acknowledged) {\n\t\t\t\t\t\tif (!this.skipCache) {\n\t\t\t\t\t\t\tResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn res.modifiedCount;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tthrow new Error(`Error in Aggregate: ${this.collectionName} - ${JSON.stringify(res, null, 2)}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch (err) {\n\t\t\t\t\tconsole.log(new Date(), 'Error Update One', this.collectionName, filter, update, safeOptions, err);\n\t\t\t\t\terr.message = `Error in Aggregate: ${this.collectionName} - ${err.message}`;\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t\tfinally {\n\t\t\t\t\tawait monitor.finish();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t\n\twatchCollection(pipeline = [], options?: ChangeStreamOptions, bypassSession = false): ChangeStream<T> {\n\t\tconst session = ResolveIOServer.getMongoManager().getSession();\n\t\tif (session && !bypassSession && !this.bypassSession) {\n\t\t\tif (!options) {\n\t\t\t\toptions = {session};\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.session = session;\n\t\t\t}\n\t\t}\n\t\t\n\t\tlet stream = ResolveIOServer.getMainDB().collection<T>(this.collectionName, this.collectionOptions).watch(pipeline, options);\n\t\treturn <ChangeStream<T>>stream;\n\t}\n}\n\nexport class MongoManagerUserCollection<T extends CollectionDocument> extends MongoManagerCollection<T> {\n\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, cb) => {\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}"]}