typeorm 0.3.15-dev.3a72e35 → 0.3.15-dev.f1c5662

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 (125) hide show
  1. package/README.md +1 -1
  2. package/browser/cache/DbQueryResultCache.d.ts +1 -1
  3. package/browser/cache/DbQueryResultCache.js +1 -1
  4. package/browser/cache/DbQueryResultCache.js.map +1 -1
  5. package/browser/cache/QueryResultCacheOptions.d.ts +2 -2
  6. package/browser/cache/QueryResultCacheOptions.js.map +1 -1
  7. package/browser/cache/RedisQueryResultCache.d.ts +1 -1
  8. package/browser/cache/RedisQueryResultCache.js +1 -1
  9. package/browser/cache/RedisQueryResultCache.js.map +1 -1
  10. package/browser/data-source/DataSource.js +1 -2
  11. package/browser/data-source/DataSource.js.map +1 -1
  12. package/browser/driver/mongodb/MongoDriver.js +12 -19
  13. package/browser/driver/mongodb/MongoDriver.js.map +1 -1
  14. package/browser/driver/mongodb/MongoQueryRunner.d.ts +34 -78
  15. package/browser/driver/mongodb/MongoQueryRunner.js +43 -74
  16. package/browser/driver/mongodb/MongoQueryRunner.js.map +1 -1
  17. package/browser/driver/mongodb/bson.typings.d.ts +1084 -0
  18. package/browser/driver/mongodb/bson.typings.js +3 -0
  19. package/browser/driver/mongodb/bson.typings.js.map +1 -0
  20. package/browser/driver/mongodb/typings.d.ts +4882 -4718
  21. package/browser/driver/mongodb/typings.js +23 -1
  22. package/browser/driver/mongodb/typings.js.map +1 -1
  23. package/browser/driver/sqlite-abstract/AbstractSqliteDriver.js +6 -10
  24. package/browser/driver/sqlite-abstract/AbstractSqliteDriver.js.map +1 -1
  25. package/browser/entity-manager/EntityManager.d.ts +6 -6
  26. package/browser/entity-manager/EntityManager.js.map +1 -1
  27. package/browser/entity-manager/MongoEntityManager.d.ts +46 -92
  28. package/browser/entity-manager/MongoEntityManager.js +66 -133
  29. package/browser/entity-manager/MongoEntityManager.js.map +1 -1
  30. package/browser/entity-schema/EntitySchemaColumnOptions.d.ts +1 -1
  31. package/browser/entity-schema/EntitySchemaColumnOptions.js.map +1 -1
  32. package/browser/find-options/FindOptionsOrder.d.ts +2 -2
  33. package/browser/find-options/FindOptionsOrder.js.map +1 -1
  34. package/browser/find-options/FindOptionsRelations.d.ts +2 -2
  35. package/browser/find-options/FindOptionsRelations.js.map +1 -1
  36. package/browser/find-options/FindOptionsSelect.d.ts +2 -2
  37. package/browser/find-options/FindOptionsSelect.js.map +1 -1
  38. package/browser/find-options/FindOptionsWhere.d.ts +2 -2
  39. package/browser/find-options/FindOptionsWhere.js.map +1 -1
  40. package/browser/metadata-builder/RelationJoinColumnBuilder.d.ts +1 -1
  41. package/browser/metadata-builder/RelationJoinColumnBuilder.js +18 -20
  42. package/browser/metadata-builder/RelationJoinColumnBuilder.js.map +1 -1
  43. package/browser/migration/MigrationExecutor.js +2 -4
  44. package/browser/migration/MigrationExecutor.js.map +1 -1
  45. package/browser/query-builder/SelectQueryBuilder.d.ts +1 -1
  46. package/browser/query-builder/SelectQueryBuilder.js +3 -2
  47. package/browser/query-builder/SelectQueryBuilder.js.map +1 -1
  48. package/browser/query-builder/transformer/DocumentToEntityTransformer.js +13 -6
  49. package/browser/query-builder/transformer/DocumentToEntityTransformer.js.map +1 -1
  50. package/browser/repository/BaseEntity.d.ts +4 -4
  51. package/browser/repository/BaseEntity.js.map +1 -1
  52. package/browser/repository/EntityId.d.ts +2 -2
  53. package/browser/repository/EntityId.js.map +1 -1
  54. package/browser/repository/MongoRepository.d.ts +30 -72
  55. package/browser/repository/MongoRepository.js +1 -38
  56. package/browser/repository/MongoRepository.js.map +1 -1
  57. package/browser/repository/Repository.d.ts +6 -6
  58. package/browser/repository/Repository.js.map +1 -1
  59. package/browser/schema-builder/MongoSchemaBuilder.js.map +1 -1
  60. package/browser/schema-builder/RdbmsSchemaBuilder.js +1 -1
  61. package/browser/schema-builder/RdbmsSchemaBuilder.js.map +1 -1
  62. package/cache/DbQueryResultCache.d.ts +1 -1
  63. package/cache/DbQueryResultCache.js +1 -1
  64. package/cache/DbQueryResultCache.js.map +1 -1
  65. package/cache/QueryResultCacheOptions.d.ts +2 -2
  66. package/cache/QueryResultCacheOptions.js.map +1 -1
  67. package/cache/RedisQueryResultCache.d.ts +1 -1
  68. package/cache/RedisQueryResultCache.js +1 -1
  69. package/cache/RedisQueryResultCache.js.map +1 -1
  70. package/commands/InitCommand.js +3 -3
  71. package/commands/InitCommand.js.map +1 -1
  72. package/data-source/DataSource.js +7 -8
  73. package/data-source/DataSource.js.map +1 -1
  74. package/driver/mongodb/MongoDriver.js +12 -19
  75. package/driver/mongodb/MongoDriver.js.map +1 -1
  76. package/driver/mongodb/MongoQueryRunner.d.ts +34 -78
  77. package/driver/mongodb/MongoQueryRunner.js +43 -74
  78. package/driver/mongodb/MongoQueryRunner.js.map +1 -1
  79. package/driver/mongodb/bson.typings.d.ts +1084 -0
  80. package/driver/mongodb/bson.typings.js +5 -0
  81. package/driver/mongodb/bson.typings.js.map +1 -0
  82. package/driver/mongodb/typings.d.ts +4882 -4718
  83. package/driver/mongodb/typings.js +19 -0
  84. package/driver/mongodb/typings.js.map +1 -1
  85. package/driver/sqlite-abstract/AbstractSqliteDriver.js +6 -10
  86. package/driver/sqlite-abstract/AbstractSqliteDriver.js.map +1 -1
  87. package/entity-manager/EntityManager.d.ts +6 -6
  88. package/entity-manager/EntityManager.js.map +1 -1
  89. package/entity-manager/MongoEntityManager.d.ts +46 -92
  90. package/entity-manager/MongoEntityManager.js +66 -133
  91. package/entity-manager/MongoEntityManager.js.map +1 -1
  92. package/entity-schema/EntitySchemaColumnOptions.d.ts +1 -1
  93. package/entity-schema/EntitySchemaColumnOptions.js.map +1 -1
  94. package/find-options/FindOptionsOrder.d.ts +2 -2
  95. package/find-options/FindOptionsOrder.js.map +1 -1
  96. package/find-options/FindOptionsRelations.d.ts +2 -2
  97. package/find-options/FindOptionsRelations.js.map +1 -1
  98. package/find-options/FindOptionsSelect.d.ts +2 -2
  99. package/find-options/FindOptionsSelect.js.map +1 -1
  100. package/find-options/FindOptionsWhere.d.ts +2 -2
  101. package/find-options/FindOptionsWhere.js.map +1 -1
  102. package/index.mjs +34 -0
  103. package/metadata-builder/RelationJoinColumnBuilder.d.ts +1 -1
  104. package/metadata-builder/RelationJoinColumnBuilder.js +18 -20
  105. package/metadata-builder/RelationJoinColumnBuilder.js.map +1 -1
  106. package/migration/MigrationExecutor.js +2 -4
  107. package/migration/MigrationExecutor.js.map +1 -1
  108. package/package.json +1 -1
  109. package/query-builder/SelectQueryBuilder.d.ts +1 -1
  110. package/query-builder/SelectQueryBuilder.js +3 -2
  111. package/query-builder/SelectQueryBuilder.js.map +1 -1
  112. package/query-builder/transformer/DocumentToEntityTransformer.js +13 -6
  113. package/query-builder/transformer/DocumentToEntityTransformer.js.map +1 -1
  114. package/repository/BaseEntity.d.ts +4 -4
  115. package/repository/BaseEntity.js.map +1 -1
  116. package/repository/EntityId.d.ts +2 -2
  117. package/repository/EntityId.js.map +1 -1
  118. package/repository/MongoRepository.d.ts +30 -72
  119. package/repository/MongoRepository.js +1 -38
  120. package/repository/MongoRepository.js.map +1 -1
  121. package/repository/Repository.d.ts +6 -6
  122. package/repository/Repository.js.map +1 -1
  123. package/schema-builder/MongoSchemaBuilder.js.map +1 -1
  124. package/schema-builder/RdbmsSchemaBuilder.js +1 -1
  125. package/schema-builder/RdbmsSchemaBuilder.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/driver/mongodb/MongoDriver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAA;AAC7E,OAAO,EAAE,8BAA8B,EAAE,MAAM,4CAA4C,CAAA;AAE3F,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAGrD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAK5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAA;AAK5E,OAAO,EAAE,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otSetError\"\nimport { DriverPackageNotInstalledError } from \"../../error/DriverPackageNotInstalledError\"\nimport { CteCapabilities } from \"../types/CteCapabilities\"\nimport { MongoQueryRunner } from \"./MongoQueryRunner\"\nimport { ObjectLiteral } from \"../../common/ObjectLiteral\"\nimport { ColumnMetadata } from \"../../metadata/ColumnMetadata\"\nimport { PlatformTools } from \"../../platform/PlatformTools\"\nimport { DataSource } from \"../../data-source/DataSource\"\nimport { MongoConnectionOptions } from \"./MongoConnectionOptions\"\nimport { MappedColumnTypes } from \"../types/MappedColumnTypes\"\nimport { ColumnType } from \"../types/ColumnTypes\"\nimport { MongoSchemaBuilder } from \"../../schema-builder/MongoSchemaBuilder\"\nimport { DataTypeDefaults } from \"../types/DataTypeDefaults\"\nimport { TableColumn } from \"../../schema-builder/table/TableColumn\"\nimport { DataSourceOptions } from \"../../data-source/DataSourceOptions\"\nimport { EntityMetadata } from \"../../metadata/EntityMetadata\"\nimport { ObjectUtils } from \"../../util/ObjectUtils\"\nimport { ApplyValueTransformers } from \"../../util/ApplyValueTransformers\"\nimport { ReplicationMode } from \"../types/ReplicationMode\"\nimport { DriverUtils } from \"../DriverUtils\"\nimport { TypeORMError } from \"../../error\"\nimport { Table } from \"../../schema-builder/table/Table\"\nimport { View } from \"../../schema-builder/view/View\"\nimport { TableForeignKey } from \"../../schema-builder/table/TableForeignKey\"\nimport { InstanceChecker } from \"../../util/InstanceChecker\"\nimport { UpsertType } from \"../types/UpsertType\"\n\n/**\n * Organizes communication with MongoDB.\n */\nexport class MongoDriver implements Driver {\n // -------------------------------------------------------------------------\n // Public Properties\n // -------------------------------------------------------------------------\n\n /**\n * Underlying mongodb library.\n */\n mongodb: any\n\n /**\n * Mongodb does not require to dynamically create query runner each time,\n * because it does not have a regular connection pool as RDBMS systems have.\n */\n queryRunner?: MongoQueryRunner\n\n // -------------------------------------------------------------------------\n // Public Implemented Properties\n // -------------------------------------------------------------------------\n\n /**\n * Connection options.\n */\n options: MongoConnectionOptions\n\n /**\n * Master database used to perform all write queries.\n */\n database?: string\n\n /**\n * Indicates if replication is enabled.\n */\n isReplicated: boolean = false\n\n /**\n * Indicates if tree tables are supported by this driver.\n */\n treeSupport = false\n\n /**\n * Represent transaction support by this driver\n */\n transactionSupport = \"none\" as const\n\n /**\n * Mongodb does not need to have column types because they are not used in schema sync.\n */\n supportedDataTypes: ColumnType[] = []\n\n /**\n * Returns type of upsert supported by driver if any\n */\n supportedUpsertTypes: UpsertType[]\n\n /**\n * Gets list of spatial column data types.\n */\n spatialTypes: ColumnType[] = []\n\n /**\n * Gets list of column data types that support length by a driver.\n */\n withLengthColumnTypes: ColumnType[] = []\n\n /**\n * Gets list of column data types that support precision by a driver.\n */\n withPrecisionColumnTypes: ColumnType[] = []\n\n /**\n * Gets list of column data types that support scale by a driver.\n */\n withScaleColumnTypes: ColumnType[] = []\n\n /**\n * Mongodb does not need to have a strong defined mapped column types because they are not used in schema sync.\n */\n mappedDataTypes: MappedColumnTypes = {\n createDate: \"int\",\n createDateDefault: \"\",\n updateDate: \"int\",\n updateDateDefault: \"\",\n deleteDate: \"int\",\n deleteDateNullable: true,\n version: \"int\",\n treeLevel: \"int\",\n migrationId: \"int\",\n migrationName: \"int\",\n migrationTimestamp: \"int\",\n cacheId: \"int\",\n cacheIdentifier: \"int\",\n cacheTime: \"int\",\n cacheDuration: \"int\",\n cacheQuery: \"int\",\n cacheResult: \"int\",\n metadataType: \"int\",\n metadataDatabase: \"int\",\n metadataSchema: \"int\",\n metadataTable: \"int\",\n metadataName: \"int\",\n metadataValue: \"int\",\n }\n\n /**\n * Default values of length, precision and scale depends on column data type.\n * Used in the cases when length/precision/scale is not specified by user.\n */\n dataTypeDefaults: DataTypeDefaults\n\n /**\n * No documentation specifying a maximum length for identifiers could be found\n * for MongoDB.\n */\n maxAliasLength?: number\n\n // -------------------------------------------------------------------------\n // Protected Properties\n // -------------------------------------------------------------------------\n\n /**\n * Valid mongo connection options\n * NOTE: Keep sync with MongoConnectionOptions\n * Sync with http://mongodb.github.io/node-mongodb-native/3.5/api/MongoClient.html\n */\n protected validOptionNames: string[] = [\n \"poolSize\",\n \"ssl\",\n \"sslValidate\",\n \"sslCA\",\n \"sslCert\",\n \"sslKey\",\n \"sslPass\",\n \"sslCRL\",\n \"autoReconnect\",\n \"noDelay\",\n \"keepAlive\",\n \"keepAliveInitialDelay\",\n \"connectTimeoutMS\",\n \"family\",\n \"socketTimeoutMS\",\n \"reconnectTries\",\n \"reconnectInterval\",\n \"ha\",\n \"haInterval\",\n \"replicaSet\",\n \"secondaryAcceptableLatencyMS\",\n \"acceptableLatencyMS\",\n \"connectWithNoPrimary\",\n \"authSource\",\n \"w\",\n \"wtimeout\",\n \"j\",\n \"writeConcern\",\n \"forceServerObjectId\",\n \"serializeFunctions\",\n \"ignoreUndefined\",\n \"raw\",\n \"bufferMaxEntries\",\n \"readPreference\",\n \"pkFactory\",\n \"promiseLibrary\",\n \"readConcern\",\n \"maxStalenessSeconds\",\n \"loggerLevel\",\n // Do not overwrite BaseDataSourceOptions.logger\n // \"logger\",\n \"promoteValues\",\n \"promoteBuffers\",\n \"promoteLongs\",\n \"domainsEnabled\",\n \"checkServerIdentity\",\n \"validateOptions\",\n \"appname\",\n // omit auth - we are building url from username and password\n // \"auth\"\n \"authMechanism\",\n \"compression\",\n \"fsync\",\n \"readPreferenceTags\",\n \"numberOfRetries\",\n \"auto_reconnect\",\n \"minSize\",\n \"monitorCommands\",\n \"useNewUrlParser\",\n \"useUnifiedTopology\",\n \"autoEncryption\",\n \"retryWrites\",\n ]\n\n cteCapabilities: CteCapabilities = {\n enabled: false,\n }\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(protected connection: DataSource) {\n this.options = connection.options as MongoConnectionOptions\n\n // validate options to make sure everything is correct and driver will be able to establish connection\n this.validateOptions(connection.options)\n\n // load mongodb package\n this.loadDependencies()\n\n this.database = DriverUtils.buildMongoDBDriverOptions(\n this.options,\n ).database\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Performs connection to the database.\n */\n connect(): Promise<void> {\n return new Promise<void>((ok, fail) => {\n const options = DriverUtils.buildMongoDBDriverOptions(this.options)\n\n this.mongodb.MongoClient.connect(\n this.buildConnectionUrl(options),\n this.buildConnectionOptions(options),\n (err: any, client: any) => {\n if (err) return fail(err)\n\n this.queryRunner = new MongoQueryRunner(\n this.connection,\n client,\n )\n ObjectUtils.assign(this.queryRunner, {\n manager: this.connection.manager,\n })\n ok()\n },\n )\n })\n }\n\n afterConnect(): Promise<void> {\n return Promise.resolve()\n }\n\n /**\n * Closes connection with the database.\n */\n async disconnect(): Promise<void> {\n return new Promise<void>((ok, fail) => {\n if (!this.queryRunner)\n return fail(new ConnectionIsNotSetError(\"mongodb\"))\n\n const handler = (err: any) => (err ? fail(err) : ok())\n this.queryRunner.databaseConnection.close(handler)\n this.queryRunner = undefined\n })\n }\n\n /**\n * Creates a schema builder used to build and sync a schema.\n */\n createSchemaBuilder() {\n return new MongoSchemaBuilder(this.connection)\n }\n\n /**\n * Creates a query runner used to execute database queries.\n */\n createQueryRunner(mode: ReplicationMode) {\n return this.queryRunner!\n }\n\n /**\n * Replaces parameters in the given sql with special escaping character\n * and an array of parameter names to be passed to a query.\n */\n escapeQueryWithParameters(\n sql: string,\n parameters: ObjectLiteral,\n nativeParameters: ObjectLiteral,\n ): [string, any[]] {\n throw new TypeORMError(\n `This operation is not supported by Mongodb driver.`,\n )\n }\n\n /**\n * Escapes a column name.\n */\n escape(columnName: string): string {\n return columnName\n }\n\n /**\n * Build full table name with database name, schema name and table name.\n * E.g. myDB.mySchema.myTable\n */\n buildTableName(\n tableName: string,\n schema?: string,\n database?: string,\n ): string {\n return tableName\n }\n\n /**\n * Parse a target table name or other types and return a normalized table definition.\n */\n parseTableName(\n target: EntityMetadata | Table | View | TableForeignKey | string,\n ): { tableName: string; schema?: string; database?: string } {\n if (InstanceChecker.isEntityMetadata(target)) {\n return {\n tableName: target.tableName,\n }\n }\n\n if (InstanceChecker.isTable(target) || InstanceChecker.isView(target)) {\n return {\n tableName: target.name,\n }\n }\n\n if (InstanceChecker.isTableForeignKey(target)) {\n return {\n tableName: target.referencedTableName,\n }\n }\n\n return {\n tableName: target,\n }\n }\n\n /**\n * Prepares given value to a value to be persisted, based on its column type and metadata.\n */\n preparePersistentValue(value: any, columnMetadata: ColumnMetadata): any {\n if (columnMetadata.transformer)\n value = ApplyValueTransformers.transformTo(\n columnMetadata.transformer,\n value,\n )\n return value\n }\n\n /**\n * Prepares given value to a value to be persisted, based on its column type or metadata.\n */\n prepareHydratedValue(value: any, columnMetadata: ColumnMetadata): any {\n if (columnMetadata.transformer)\n value = ApplyValueTransformers.transformFrom(\n columnMetadata.transformer,\n value,\n )\n return value\n }\n\n /**\n * Creates a database type from a given column metadata.\n */\n normalizeType(column: {\n type?: ColumnType\n length?: number | string\n precision?: number | null\n scale?: number\n }): string {\n throw new TypeORMError(\n `MongoDB is schema-less, not supported by this driver.`,\n )\n }\n\n /**\n * Normalizes \"default\" value of the column.\n */\n normalizeDefault(columnMetadata: ColumnMetadata): string | undefined {\n throw new TypeORMError(\n `MongoDB is schema-less, not supported by this driver.`,\n )\n }\n\n /**\n * Normalizes \"isUnique\" value of the column.\n */\n normalizeIsUnique(column: ColumnMetadata): boolean {\n throw new TypeORMError(\n `MongoDB is schema-less, not supported by this driver.`,\n )\n }\n\n /**\n * Calculates column length taking into account the default length values.\n */\n getColumnLength(column: ColumnMetadata): string {\n throw new TypeORMError(\n `MongoDB is schema-less, not supported by this driver.`,\n )\n }\n\n /**\n * Normalizes \"default\" value of the column.\n */\n createFullType(column: TableColumn): string {\n throw new TypeORMError(\n `MongoDB is schema-less, not supported by this driver.`,\n )\n }\n\n /**\n * Obtains a new database connection to a master server.\n * Used for replication.\n * If replication is not setup then returns default connection's database connection.\n */\n obtainMasterConnection(): Promise<any> {\n return Promise.resolve()\n }\n\n /**\n * Obtains a new database connection to a slave server.\n * Used for replication.\n * If replication is not setup then returns master (default) connection's database connection.\n */\n obtainSlaveConnection(): Promise<any> {\n return Promise.resolve()\n }\n\n /**\n * Creates generated map of values generated or returned by database after INSERT query.\n */\n createGeneratedMap(metadata: EntityMetadata, insertedId: any) {\n return metadata.objectIdColumn!.createValueMap(insertedId)\n }\n\n /**\n * Differentiate columns of this table and columns from the given column metadatas columns\n * and returns only changed.\n */\n findChangedColumns(\n tableColumns: TableColumn[],\n columnMetadatas: ColumnMetadata[],\n ): ColumnMetadata[] {\n throw new TypeORMError(\n `MongoDB is schema-less, not supported by this driver.`,\n )\n }\n\n /**\n * Returns true if driver supports RETURNING / OUTPUT statement.\n */\n isReturningSqlSupported(): boolean {\n return false\n }\n\n /**\n * Returns true if driver supports uuid values generation on its own.\n */\n isUUIDGenerationSupported(): boolean {\n return false\n }\n\n /**\n * Returns true if driver supports fulltext indices.\n */\n isFullTextColumnTypeSupported(): boolean {\n return false\n }\n\n /**\n * Creates an escaped parameter.\n */\n createParameter(parameterName: string, index: number): string {\n return \"\"\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Validate driver options to make sure everything is correct and driver will be able to establish connection.\n */\n protected validateOptions(options: DataSourceOptions) {\n // todo: fix\n // if (!options.url) {\n // if (!options.database)\n // throw new DriverOptionNotSetError(\"database\");\n // }\n }\n\n /**\n * Loads all driver dependencies.\n */\n protected loadDependencies(): any {\n try {\n const mongodb = this.options.driver || PlatformTools.load(\"mongodb\")\n this.mongodb = mongodb\n } catch (e) {\n throw new DriverPackageNotInstalledError(\"MongoDB\", \"mongodb\")\n }\n }\n\n /**\n * Builds connection url that is passed to underlying driver to perform connection to the mongodb database.\n */\n protected buildConnectionUrl(options: { [key: string]: any }): string {\n const schemaUrlPart = options.type.toLowerCase()\n const credentialsUrlPart =\n options.username && options.password\n ? `${options.username}:${options.password}@`\n : \"\"\n\n const portUrlPart =\n schemaUrlPart === \"mongodb+srv\" ? \"\" : `:${options.port || \"27017\"}`\n\n let connectionString: string\n if (options.replicaSet) {\n connectionString = `${schemaUrlPart}://${credentialsUrlPart}${\n options.hostReplicaSet ||\n options.host + portUrlPart ||\n \"127.0.0.1\" + portUrlPart\n }/${options.database || \"\"}?replicaSet=${options.replicaSet}${\n options.tls ? \"&tls=true\" : \"\"\n }`\n } else {\n connectionString = `${schemaUrlPart}://${credentialsUrlPart}${\n options.host || \"127.0.0.1\"\n }${portUrlPart}/${options.database || \"\"}${\n options.tls ? \"?tls=true\" : \"\"\n }`\n }\n\n return connectionString\n }\n\n /**\n * Build connection options from MongoConnectionOptions\n */\n protected buildConnectionOptions(options: { [key: string]: any }): any {\n const mongoOptions: any = {}\n\n for (let index = 0; index < this.validOptionNames.length; index++) {\n const optionName = this.validOptionNames[index]\n\n if (options.extra && optionName in options.extra) {\n mongoOptions[optionName] = options.extra[optionName]\n } else if (optionName in options) {\n mongoOptions[optionName] = options[optionName]\n }\n }\n\n return mongoOptions\n }\n}\n"],"sourceRoot":"../.."}
1
+ {"version":3,"sources":["../browser/src/driver/mongodb/MongoDriver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAA;AAC7E,OAAO,EAAE,8BAA8B,EAAE,MAAM,4CAA4C,CAAA;AAE3F,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAGrD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAK5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAA;AAK5E,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAA;AAE1E,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAI1C,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAG5D;;GAEG;AACH,MAAM,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AAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YAC/D,MAAM,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAA;YAE/C,IAAI,OAAO,CAAC,KAAK,IAAI,UAAU,IAAI,OAAO,CAAC,KAAK,EAAE;gBAC9C,YAAY,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;aACvD;iBAAM,IAAI,UAAU,IAAI,OAAO,EAAE;gBAC9B,YAAY,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;aACjD;SACJ;QAED,OAAO,YAAY,CAAA;IACvB,CAAC;CACJ","file":"MongoDriver.js","sourcesContent":["import { Driver } from \"../Driver\"\nimport { ConnectionIsNotSetError } from \"../../error/ConnectionIsNotSetError\"\nimport { DriverPackageNotInstalledError } from \"../../error/DriverPackageNotInstalledError\"\nimport { CteCapabilities } from \"../types/CteCapabilities\"\nimport { MongoQueryRunner } from \"./MongoQueryRunner\"\nimport { ObjectLiteral } from \"../../common/ObjectLiteral\"\nimport { ColumnMetadata } from \"../../metadata/ColumnMetadata\"\nimport { PlatformTools } from \"../../platform/PlatformTools\"\nimport { DataSource } from \"../../data-source/DataSource\"\nimport { MongoConnectionOptions } from \"./MongoConnectionOptions\"\nimport { MappedColumnTypes } from \"../types/MappedColumnTypes\"\nimport { ColumnType } from \"../types/ColumnTypes\"\nimport { MongoSchemaBuilder } from \"../../schema-builder/MongoSchemaBuilder\"\nimport { DataTypeDefaults } from \"../types/DataTypeDefaults\"\nimport { TableColumn } from \"../../schema-builder/table/TableColumn\"\nimport { DataSourceOptions } from \"../../data-source/DataSourceOptions\"\nimport { EntityMetadata } from \"../../metadata/EntityMetadata\"\nimport { ObjectUtils } from \"../../util/ObjectUtils\"\nimport { ApplyValueTransformers } from \"../../util/ApplyValueTransformers\"\nimport { ReplicationMode } from \"../types/ReplicationMode\"\nimport { DriverUtils } from \"../DriverUtils\"\nimport { TypeORMError } from \"../../error\"\nimport { Table } from \"../../schema-builder/table/Table\"\nimport { View } from \"../../schema-builder/view/View\"\nimport { TableForeignKey } from \"../../schema-builder/table/TableForeignKey\"\nimport { InstanceChecker } from \"../../util/InstanceChecker\"\nimport { UpsertType } from \"../types/UpsertType\"\n\n/**\n * Organizes communication with MongoDB.\n */\nexport class MongoDriver implements Driver {\n // -------------------------------------------------------------------------\n // Public Properties\n // -------------------------------------------------------------------------\n\n /**\n * Underlying mongodb library.\n */\n mongodb: any\n\n /**\n * Mongodb does not require to dynamically create query runner each time,\n * because it does not have a regular connection pool as RDBMS systems have.\n */\n queryRunner?: MongoQueryRunner\n\n // -------------------------------------------------------------------------\n // Public Implemented Properties\n // -------------------------------------------------------------------------\n\n /**\n * Connection options.\n */\n options: MongoConnectionOptions\n\n /**\n * Master database used to perform all write queries.\n */\n database?: string\n\n /**\n * Indicates if replication is enabled.\n */\n isReplicated: boolean = false\n\n /**\n * Indicates if tree tables are supported by this driver.\n */\n treeSupport = false\n\n /**\n * Represent transaction support by this driver\n */\n transactionSupport = \"none\" as const\n\n /**\n * Mongodb does not need to have column types because they are not used in schema sync.\n */\n supportedDataTypes: ColumnType[] = []\n\n /**\n * Returns type of upsert supported by driver if any\n */\n supportedUpsertTypes: UpsertType[]\n\n /**\n * Gets list of spatial column data types.\n */\n spatialTypes: ColumnType[] = []\n\n /**\n * Gets list of column data types that support length by a driver.\n */\n withLengthColumnTypes: ColumnType[] = []\n\n /**\n * Gets list of column data types that support precision by a driver.\n */\n withPrecisionColumnTypes: ColumnType[] = []\n\n /**\n * Gets list of column data types that support scale by a driver.\n */\n withScaleColumnTypes: ColumnType[] = []\n\n /**\n * Mongodb does not need to have a strong defined mapped column types because they are not used in schema sync.\n */\n mappedDataTypes: MappedColumnTypes = {\n createDate: \"int\",\n createDateDefault: \"\",\n updateDate: \"int\",\n updateDateDefault: \"\",\n deleteDate: \"int\",\n deleteDateNullable: true,\n version: \"int\",\n treeLevel: \"int\",\n migrationId: \"int\",\n migrationName: \"int\",\n migrationTimestamp: \"int\",\n cacheId: \"int\",\n cacheIdentifier: \"int\",\n cacheTime: \"int\",\n cacheDuration: \"int\",\n cacheQuery: \"int\",\n cacheResult: \"int\",\n metadataType: \"int\",\n metadataDatabase: \"int\",\n metadataSchema: \"int\",\n metadataTable: \"int\",\n metadataName: \"int\",\n metadataValue: \"int\",\n }\n\n /**\n * Default values of length, precision and scale depends on column data type.\n * Used in the cases when length/precision/scale is not specified by user.\n */\n dataTypeDefaults: DataTypeDefaults\n\n /**\n * No documentation specifying a maximum length for identifiers could be found\n * for MongoDB.\n */\n maxAliasLength?: number\n\n // -------------------------------------------------------------------------\n // Protected Properties\n // -------------------------------------------------------------------------\n\n /**\n * Valid mongo connection options\n * NOTE: Keep sync with MongoConnectionOptions\n * Sync with http://mongodb.github.io/node-mongodb-native/3.5/api/MongoClient.html\n */\n protected validOptionNames: string[] = [\n \"poolSize\",\n \"ssl\",\n \"sslValidate\",\n \"sslCA\",\n \"sslCert\",\n \"sslKey\",\n \"sslPass\",\n \"sslCRL\",\n \"autoReconnect\",\n \"noDelay\",\n \"keepAlive\",\n \"keepAliveInitialDelay\",\n \"connectTimeoutMS\",\n \"family\",\n \"socketTimeoutMS\",\n \"reconnectTries\",\n \"reconnectInterval\",\n \"ha\",\n \"haInterval\",\n \"replicaSet\",\n \"secondaryAcceptableLatencyMS\",\n \"acceptableLatencyMS\",\n \"connectWithNoPrimary\",\n \"authSource\",\n \"w\",\n \"wtimeout\",\n \"j\",\n \"writeConcern\",\n \"forceServerObjectId\",\n \"serializeFunctions\",\n \"ignoreUndefined\",\n \"raw\",\n \"bufferMaxEntries\",\n \"readPreference\",\n \"pkFactory\",\n \"promiseLibrary\",\n \"readConcern\",\n \"maxStalenessSeconds\",\n \"loggerLevel\",\n // Do not overwrite BaseDataSourceOptions.logger\n // \"logger\",\n \"promoteValues\",\n \"promoteBuffers\",\n \"promoteLongs\",\n \"domainsEnabled\",\n \"checkServerIdentity\",\n \"validateOptions\",\n \"appname\",\n // omit auth - we are building url from username and password\n // \"auth\"\n \"authMechanism\",\n \"compression\",\n \"fsync\",\n \"readPreferenceTags\",\n \"numberOfRetries\",\n \"auto_reconnect\",\n \"minSize\",\n \"monitorCommands\",\n \"useNewUrlParser\",\n \"useUnifiedTopology\",\n \"autoEncryption\",\n \"retryWrites\",\n ]\n\n cteCapabilities: CteCapabilities = {\n enabled: false,\n }\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(protected connection: DataSource) {\n this.options = connection.options as MongoConnectionOptions\n\n // validate options to make sure everything is correct and driver will be able to establish connection\n this.validateOptions(connection.options)\n\n // load mongodb package\n this.loadDependencies()\n\n this.database = DriverUtils.buildMongoDBDriverOptions(\n this.options,\n ).database\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Performs connection to the database.\n */\n async connect(): Promise<void> {\n const options = DriverUtils.buildMongoDBDriverOptions(this.options)\n\n const client = await this.mongodb.MongoClient.connect(\n this.buildConnectionUrl(options),\n this.buildConnectionOptions(options),\n )\n\n this.queryRunner = new MongoQueryRunner(this.connection, client)\n ObjectUtils.assign(this.queryRunner, {\n manager: this.connection.manager,\n })\n }\n\n afterConnect(): Promise<void> {\n return Promise.resolve()\n }\n\n /**\n * Closes connection with the database.\n */\n async disconnect(): Promise<void> {\n if (!this.queryRunner) throw new ConnectionIsNotSetError(\"mongodb\")\n // const handler = (err: any) => (err ? fail(err) : ok())\n this.queryRunner.databaseConnection.close()\n this.queryRunner = undefined\n // return ok()\n }\n\n /**\n * Creates a schema builder used to build and sync a schema.\n */\n createSchemaBuilder() {\n return new MongoSchemaBuilder(this.connection)\n }\n\n /**\n * Creates a query runner used to execute database queries.\n */\n createQueryRunner(mode: ReplicationMode) {\n return this.queryRunner!\n }\n\n /**\n * Replaces parameters in the given sql with special escaping character\n * and an array of parameter names to be passed to a query.\n */\n escapeQueryWithParameters(\n sql: string,\n parameters: ObjectLiteral,\n nativeParameters: ObjectLiteral,\n ): [string, any[]] {\n throw new TypeORMError(\n `This operation is not supported by Mongodb driver.`,\n )\n }\n\n /**\n * Escapes a column name.\n */\n escape(columnName: string): string {\n return columnName\n }\n\n /**\n * Build full table name with database name, schema name and table name.\n * E.g. myDB.mySchema.myTable\n */\n buildTableName(\n tableName: string,\n schema?: string,\n database?: string,\n ): string {\n return tableName\n }\n\n /**\n * Parse a target table name or other types and return a normalized table definition.\n */\n parseTableName(\n target: EntityMetadata | Table | View | TableForeignKey | string,\n ): { tableName: string; schema?: string; database?: string } {\n if (InstanceChecker.isEntityMetadata(target)) {\n return {\n tableName: target.tableName,\n }\n }\n\n if (InstanceChecker.isTable(target) || InstanceChecker.isView(target)) {\n return {\n tableName: target.name,\n }\n }\n\n if (InstanceChecker.isTableForeignKey(target)) {\n return {\n tableName: target.referencedTableName,\n }\n }\n\n return {\n tableName: target,\n }\n }\n\n /**\n * Prepares given value to a value to be persisted, based on its column type and metadata.\n */\n preparePersistentValue(value: any, columnMetadata: ColumnMetadata): any {\n if (columnMetadata.transformer)\n value = ApplyValueTransformers.transformTo(\n columnMetadata.transformer,\n value,\n )\n return value\n }\n\n /**\n * Prepares given value to a value to be persisted, based on its column type or metadata.\n */\n prepareHydratedValue(value: any, columnMetadata: ColumnMetadata): any {\n if (columnMetadata.transformer)\n value = ApplyValueTransformers.transformFrom(\n columnMetadata.transformer,\n value,\n )\n return value\n }\n\n /**\n * Creates a database type from a given column metadata.\n */\n normalizeType(column: {\n type?: ColumnType\n length?: number | string\n precision?: number | null\n scale?: number\n }): string {\n throw new TypeORMError(\n `MongoDB is schema-less, not supported by this driver.`,\n )\n }\n\n /**\n * Normalizes \"default\" value of the column.\n */\n normalizeDefault(columnMetadata: ColumnMetadata): string | undefined {\n throw new TypeORMError(\n `MongoDB is schema-less, not supported by this driver.`,\n )\n }\n\n /**\n * Normalizes \"isUnique\" value of the column.\n */\n normalizeIsUnique(column: ColumnMetadata): boolean {\n throw new TypeORMError(\n `MongoDB is schema-less, not supported by this driver.`,\n )\n }\n\n /**\n * Calculates column length taking into account the default length values.\n */\n getColumnLength(column: ColumnMetadata): string {\n throw new TypeORMError(\n `MongoDB is schema-less, not supported by this driver.`,\n )\n }\n\n /**\n * Normalizes \"default\" value of the column.\n */\n createFullType(column: TableColumn): string {\n throw new TypeORMError(\n `MongoDB is schema-less, not supported by this driver.`,\n )\n }\n\n /**\n * Obtains a new database connection to a master server.\n * Used for replication.\n * If replication is not setup then returns default connection's database connection.\n */\n obtainMasterConnection(): Promise<any> {\n return Promise.resolve()\n }\n\n /**\n * Obtains a new database connection to a slave server.\n * Used for replication.\n * If replication is not setup then returns master (default) connection's database connection.\n */\n obtainSlaveConnection(): Promise<any> {\n return Promise.resolve()\n }\n\n /**\n * Creates generated map of values generated or returned by database after INSERT query.\n */\n createGeneratedMap(metadata: EntityMetadata, insertedId: any) {\n return metadata.objectIdColumn!.createValueMap(insertedId)\n }\n\n /**\n * Differentiate columns of this table and columns from the given column metadatas columns\n * and returns only changed.\n */\n findChangedColumns(\n tableColumns: TableColumn[],\n columnMetadatas: ColumnMetadata[],\n ): ColumnMetadata[] {\n throw new TypeORMError(\n `MongoDB is schema-less, not supported by this driver.`,\n )\n }\n\n /**\n * Returns true if driver supports RETURNING / OUTPUT statement.\n */\n isReturningSqlSupported(): boolean {\n return false\n }\n\n /**\n * Returns true if driver supports uuid values generation on its own.\n */\n isUUIDGenerationSupported(): boolean {\n return false\n }\n\n /**\n * Returns true if driver supports fulltext indices.\n */\n isFullTextColumnTypeSupported(): boolean {\n return false\n }\n\n /**\n * Creates an escaped parameter.\n */\n createParameter(parameterName: string, index: number): string {\n return \"\"\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Validate driver options to make sure everything is correct and driver will be able to establish connection.\n */\n protected validateOptions(options: DataSourceOptions) {\n // todo: fix\n // if (!options.url) {\n // if (!options.database)\n // throw new DriverOptionNotSetError(\"database\");\n // }\n }\n\n /**\n * Loads all driver dependencies.\n */\n protected loadDependencies(): any {\n try {\n const mongodb = this.options.driver || PlatformTools.load(\"mongodb\")\n this.mongodb = mongodb\n } catch (e) {\n throw new DriverPackageNotInstalledError(\"MongoDB\", \"mongodb\")\n }\n }\n\n /**\n * Builds connection url that is passed to underlying driver to perform connection to the mongodb database.\n */\n protected buildConnectionUrl(options: { [key: string]: any }): string {\n const schemaUrlPart = options.type.toLowerCase()\n const credentialsUrlPart =\n options.username && options.password\n ? `${options.username}:${options.password}@`\n : \"\"\n\n const portUrlPart =\n schemaUrlPart === \"mongodb+srv\" ? \"\" : `:${options.port || \"27017\"}`\n\n let connectionString: string\n if (options.replicaSet) {\n connectionString = `${schemaUrlPart}://${credentialsUrlPart}${\n options.hostReplicaSet ||\n options.host + portUrlPart ||\n \"127.0.0.1\" + portUrlPart\n }/${options.database || \"\"}?replicaSet=${options.replicaSet}${\n options.tls ? \"&tls=true\" : \"\"\n }`\n } else {\n connectionString = `${schemaUrlPart}://${credentialsUrlPart}${\n options.host || \"127.0.0.1\"\n }${portUrlPart}/${options.database || \"\"}${\n options.tls ? \"?tls=true\" : \"\"\n }`\n }\n\n return connectionString\n }\n\n /**\n * Build connection options from MongoConnectionOptions\n */\n protected buildConnectionOptions(options: { [key: string]: any }): any {\n const mongoOptions: any = {}\n\n for (let index = 0; index < this.validOptionNames.length; index++) {\n const optionName = this.validOptionNames[index]\n\n if (options.extra && optionName in options.extra) {\n mongoOptions[optionName] = options.extra[optionName]\n } else if (optionName in options) {\n mongoOptions[optionName] = options[optionName]\n }\n }\n\n return mongoOptions\n }\n}\n"],"sourceRoot":"../.."}
@@ -1,13 +1,10 @@
1
1
 
2
2
  import { QueryRunner } from "../../query-runner/QueryRunner";
3
- import { ObjectLiteral } from "../../common/ObjectLiteral";
4
3
  import { TableColumn } from "../../schema-builder/table/TableColumn";
5
4
  import { Table } from "../../schema-builder/table/Table";
6
5
  import { TableForeignKey } from "../../schema-builder/table/TableForeignKey";
7
6
  import { TableIndex } from "../../schema-builder/table/TableIndex";
8
7
  import { View } from "../../schema-builder/view/View";
9
- import { AggregationCursor, BulkWriteOpResultObject, ChangeStream, ChangeStreamOptions, Code, Collection, CollectionAggregationOptions, CollectionBulkWriteOptions, CollectionInsertManyOptions, CollectionInsertOneOptions, CollectionOptions, CollStats, CommandCursor, Cursor, DeleteWriteOpResultObject, FindAndModifyWriteOpResultObject, FindOneAndReplaceOption, GeoHaystackSearchOptions, GeoNearOptions, InsertOneWriteOpResult, InsertWriteOpResult, MapReduceOptions, MongoClient, MongoCountPreferences, MongodbIndexOptions, OrderedBulkOperation, ParallelCollectionScanOptions, ReadPreference, ReplaceOneOptions, UnorderedBulkOperation, UpdateWriteOpResult } from "./typings";
10
- import { DataSource } from "../../data-source/DataSource";
11
8
  import { ReadStream } from "../../platform/PlatformTools";
12
9
  import { MongoEntityManager } from "../../entity-manager/MongoEntityManager";
13
10
  import { SqlInMemory } from "../SqlInMemory";
@@ -15,6 +12,8 @@ import { TableUnique } from "../../schema-builder/table/TableUnique";
15
12
  import { Broadcaster } from "../../subscriber/Broadcaster";
16
13
  import { TableCheck } from "../../schema-builder/table/TableCheck";
17
14
  import { TableExclusion } from "../../schema-builder/table/TableExclusion";
15
+ import { BulkWriteResult, AggregationCursor, MongoClient, Collection, FindCursor, Document, AggregateOptions, AnyBulkWriteOperation, BulkWriteOptions, Filter, CountOptions, CountDocumentsOptions, IndexSpecification, CreateIndexesOptions, IndexDescription, DeleteResult, DeleteOptions, CommandOperationOptions, FindOneAndDeleteOptions, FindOneAndReplaceOptions, UpdateFilter, FindOneAndUpdateOptions, RenameOptions, ReplaceOptions, UpdateResult, CollStats, CollStatsOptions, ChangeStreamOptions, ChangeStream, UpdateOptions, ListIndexesOptions, ListIndexesCursor, OptionalId, InsertOneOptions, InsertOneResult, InsertManyResult, UnorderedBulkOperation, OrderedBulkOperation, IndexInformationOptions } from "../../driver/mongodb/typings";
16
+ import { DataSource } from "../../data-source/DataSource";
18
17
  import { ReplicationMode } from "../types/ReplicationMode";
19
18
  /**
20
19
  * Runs queries on a single MongoDB connection.
@@ -72,84 +71,68 @@ export declare class MongoQueryRunner implements QueryRunner {
72
71
  /**
73
72
  * Creates a cursor for a query that can be used to iterate over results from MongoDB.
74
73
  */
75
- cursor(collectionName: string, query?: ObjectLiteral): Cursor<any>;
74
+ cursor(collectionName: string, filter: Filter<Document>): FindCursor<any>;
76
75
  /**
77
76
  * Execute an aggregation framework pipeline against the collection.
78
77
  */
79
- aggregate(collectionName: string, pipeline: ObjectLiteral[], options?: CollectionAggregationOptions): AggregationCursor<any>;
78
+ aggregate(collectionName: string, pipeline: Document[], options?: AggregateOptions): AggregationCursor<any>;
80
79
  /**
81
80
  * Perform a bulkWrite operation without a fluent API.
82
81
  */
83
- bulkWrite(collectionName: string, operations: ObjectLiteral[], options?: CollectionBulkWriteOptions): Promise<BulkWriteOpResultObject>;
82
+ bulkWrite(collectionName: string, operations: AnyBulkWriteOperation<Document>[], options?: BulkWriteOptions): Promise<BulkWriteResult>;
83
+ /**
84
+ * Count number of matching documents in the db to a query.
85
+ */
86
+ count(collectionName: string, filter: Filter<Document>, options?: CountOptions): Promise<number>;
84
87
  /**
85
88
  * Count number of matching documents in the db to a query.
86
89
  */
87
- count(collectionName: string, query?: ObjectLiteral, options?: MongoCountPreferences): Promise<any>;
90
+ countDocuments(collectionName: string, filter: Filter<Document>, options?: CountDocumentsOptions): Promise<any>;
88
91
  /**
89
92
  * Creates an index on the db and collection.
90
93
  */
91
- createCollectionIndex(collectionName: string, fieldOrSpec: string | any, options?: MongodbIndexOptions): Promise<string>;
94
+ createCollectionIndex(collectionName: string, indexSpec: IndexSpecification, options?: CreateIndexesOptions): Promise<string>;
92
95
  /**
93
96
  * Creates multiple indexes in the collection, this method is only supported for MongoDB 2.6 or higher.
94
97
  * Earlier version of MongoDB will throw a command not supported error. Index specifications are defined at http://docs.mongodb.org/manual/reference/command/createIndexes/.
95
98
  */
96
- createCollectionIndexes(collectionName: string, indexSpecs: ObjectLiteral[]): Promise<void>;
99
+ createCollectionIndexes(collectionName: string, indexSpecs: IndexDescription[]): Promise<string[]>;
97
100
  /**
98
101
  * Delete multiple documents on MongoDB.
99
102
  */
100
- deleteMany(collectionName: string, query: ObjectLiteral, options?: CollectionOptions): Promise<DeleteWriteOpResultObject>;
103
+ deleteMany(collectionName: string, filter: Filter<Document>, options: DeleteOptions): Promise<DeleteResult>;
101
104
  /**
102
105
  * Delete a document on MongoDB.
103
106
  */
104
- deleteOne(collectionName: string, query: ObjectLiteral, options?: CollectionOptions): Promise<DeleteWriteOpResultObject>;
107
+ deleteOne(collectionName: string, filter: Filter<Document>, options?: DeleteOptions): Promise<DeleteResult>;
105
108
  /**
106
109
  * The distinct command returns returns a list of distinct values for the given key across a collection.
107
110
  */
108
- distinct(collectionName: string, key: string, query: ObjectLiteral, options?: {
109
- readPreference?: ReadPreference | string;
110
- }): Promise<any>;
111
+ distinct(collectionName: string, key: any, filter: Filter<Document>, options?: CommandOperationOptions): Promise<any>;
111
112
  /**
112
113
  * Drops an index from this collection.
113
114
  */
114
- dropCollectionIndex(collectionName: string, indexName: string, options?: CollectionOptions): Promise<any>;
115
+ dropCollectionIndex(collectionName: string, indexName: string, options?: CommandOperationOptions): Promise<Document>;
115
116
  /**
116
117
  * Drops all indexes from the collection.
117
118
  */
118
- dropCollectionIndexes(collectionName: string): Promise<any>;
119
+ dropCollectionIndexes(collectionName: string): Promise<Document>;
119
120
  /**
120
121
  * Find a document and delete it in one atomic operation, requires a write lock for the duration of the operation.
121
122
  */
122
- findOneAndDelete(collectionName: string, query: ObjectLiteral, options?: {
123
- projection?: Object;
124
- sort?: Object;
125
- maxTimeMS?: number;
126
- }): Promise<FindAndModifyWriteOpResultObject>;
123
+ findOneAndDelete(collectionName: string, filter: Filter<Document>, options?: FindOneAndDeleteOptions): Promise<Document>;
127
124
  /**
128
125
  * Find a document and replace it in one atomic operation, requires a write lock for the duration of the operation.
129
126
  */
130
- findOneAndReplace(collectionName: string, query: ObjectLiteral, replacement: Object, options?: FindOneAndReplaceOption): Promise<FindAndModifyWriteOpResultObject>;
127
+ findOneAndReplace(collectionName: string, filter: Filter<Document>, replacement: Document, options?: FindOneAndReplaceOptions): Promise<Document>;
131
128
  /**
132
129
  * Find a document and update it in one atomic operation, requires a write lock for the duration of the operation.
133
130
  */
134
- findOneAndUpdate(collectionName: string, query: ObjectLiteral, update: Object, options?: FindOneAndReplaceOption): Promise<FindAndModifyWriteOpResultObject>;
135
- /**
136
- * Execute a geo search using a geo haystack index on a collection.
137
- */
138
- geoHaystackSearch(collectionName: string, x: number, y: number, options?: GeoHaystackSearchOptions): Promise<any>;
139
- /**
140
- * Execute the geoNear command to search for items in the collection.
141
- */
142
- geoNear(collectionName: string, x: number, y: number, options?: GeoNearOptions): Promise<any>;
143
- /**
144
- * Run a group command across a collection.
145
- */
146
- group(collectionName: string, keys: Object | Array<any> | Function | Code, condition: Object, initial: Object, reduce: Function | Code, finalize: Function | Code, command: boolean, options?: {
147
- readPreference?: ReadPreference | string;
148
- }): Promise<any>;
131
+ findOneAndUpdate(collectionName: string, filter: Filter<Document>, update: UpdateFilter<Document>, options?: FindOneAndUpdateOptions): Promise<Document>;
149
132
  /**
150
133
  * Retrieve all the indexes on the collection.
151
134
  */
152
- collectionIndexes(collectionName: string): Promise<any>;
135
+ collectionIndexes(collectionName: string): Promise<Document>;
153
136
  /**
154
137
  * Retrieve all the indexes on the collection.
155
138
  */
@@ -157,82 +140,55 @@ export declare class MongoQueryRunner implements QueryRunner {
157
140
  /**
158
141
  * Retrieves this collections index info.
159
142
  */
160
- collectionIndexInformation(collectionName: string, options?: {
161
- full: boolean;
162
- }): Promise<any>;
143
+ collectionIndexInformation(collectionName: string, options?: IndexInformationOptions): Promise<any>;
163
144
  /**
164
145
  * Initiate an In order bulk write operation, operations will be serially executed in the order they are added, creating a new operation for each switch in types.
165
146
  */
166
- initializeOrderedBulkOp(collectionName: string, options?: CollectionOptions): OrderedBulkOperation;
147
+ initializeOrderedBulkOp(collectionName: string, options?: BulkWriteOptions): OrderedBulkOperation;
167
148
  /**
168
149
  * Initiate a Out of order batch write operation. All operations will be buffered into insert/update/remove commands executed out of order.
169
150
  */
170
- initializeUnorderedBulkOp(collectionName: string, options?: CollectionOptions): UnorderedBulkOperation;
151
+ initializeUnorderedBulkOp(collectionName: string, options?: BulkWriteOptions): UnorderedBulkOperation;
171
152
  /**
172
153
  * Inserts an array of documents into MongoDB.
173
154
  */
174
- insertMany(collectionName: string, docs: ObjectLiteral[], options?: CollectionInsertManyOptions): Promise<InsertWriteOpResult>;
155
+ insertMany(collectionName: string, docs: OptionalId<Document>[], options?: BulkWriteOptions): Promise<InsertManyResult>;
175
156
  /**
176
157
  * Inserts a single document into MongoDB.
177
158
  */
178
- insertOne(collectionName: string, doc: ObjectLiteral, options?: CollectionInsertOneOptions): Promise<InsertOneWriteOpResult>;
159
+ insertOne(collectionName: string, doc: OptionalId<Document>, options?: InsertOneOptions): Promise<InsertOneResult>;
179
160
  /**
180
161
  * Returns if the collection is a capped collection.
181
162
  */
182
- isCapped(collectionName: string): Promise<any>;
163
+ isCapped(collectionName: string): Promise<boolean>;
183
164
  /**
184
165
  * Get the list of all indexes information for the collection.
185
166
  */
186
- listCollectionIndexes(collectionName: string, options?: {
187
- batchSize?: number;
188
- readPreference?: ReadPreference | string;
189
- }): CommandCursor;
190
- /**
191
- * Run Map Reduce across a collection. Be aware that the inline option for out will return an array of results not a collection.
192
- */
193
- mapReduce(collectionName: string, map: Function | string, reduce: Function | string, options?: MapReduceOptions): Promise<any>;
194
- /**
195
- * Return N number of parallel cursors for a collection allowing parallel reading of entire collection.
196
- * There are no ordering guarantees for returned results.
197
- */
198
- parallelCollectionScan(collectionName: string, options?: ParallelCollectionScanOptions): Promise<Cursor<any>[]>;
199
- /**
200
- * Reindex all indexes on the collection Warning: reIndex is a blocking operation (indexes are rebuilt in the foreground) and will be slow for large collections.
201
- */
202
- reIndex(collectionName: string): Promise<any>;
167
+ listCollectionIndexes(collectionName: string, options?: ListIndexesOptions): ListIndexesCursor;
203
168
  /**
204
169
  * Reindex all indexes on the collection Warning: reIndex is a blocking operation (indexes are rebuilt in the foreground) and will be slow for large collections.
205
170
  */
206
- rename(collectionName: string, newName: string, options?: {
207
- dropTarget?: boolean;
208
- }): Promise<Collection<any>>;
171
+ rename(collectionName: string, newName: string, options?: RenameOptions): Promise<Collection<Document>>;
209
172
  /**
210
173
  * Replace a document on MongoDB.
211
174
  */
212
- replaceOne(collectionName: string, query: ObjectLiteral, doc: ObjectLiteral, options?: ReplaceOneOptions): Promise<UpdateWriteOpResult>;
175
+ replaceOne(collectionName: string, filter: Filter<Document>, replacement: Document, options?: ReplaceOptions): Promise<Document | UpdateResult>;
213
176
  /**
214
177
  * Get all the collection statistics.
215
178
  */
216
- stats(collectionName: string, options?: {
217
- scale: number;
218
- }): Promise<CollStats>;
179
+ stats(collectionName: string, options?: CollStatsOptions): Promise<CollStats>;
219
180
  /**
220
181
  * Watching new changes as stream.
221
182
  */
222
- watch(collectionName: string, pipeline?: Object[], options?: ChangeStreamOptions): ChangeStream;
183
+ watch(collectionName: string, pipeline?: Document[], options?: ChangeStreamOptions): ChangeStream;
223
184
  /**
224
185
  * Update multiple documents on MongoDB.
225
186
  */
226
- updateMany(collectionName: string, query: ObjectLiteral, update: ObjectLiteral, options?: {
227
- upsert?: boolean;
228
- w?: any;
229
- wtimeout?: number;
230
- j?: boolean;
231
- }): Promise<UpdateWriteOpResult>;
187
+ updateMany(collectionName: string, filter: Filter<Document>, update: UpdateFilter<Document>, options?: UpdateOptions): Promise<Document | UpdateResult>;
232
188
  /**
233
189
  * Update a single document on MongoDB.
234
190
  */
235
- updateOne(collectionName: string, query: ObjectLiteral, update: ObjectLiteral, options?: ReplaceOneOptions): Promise<UpdateWriteOpResult>;
191
+ updateOne(collectionName: string, filter: Filter<Document>, update: UpdateFilter<Document>, options?: UpdateOptions): Promise<Document | UpdateResult>;
236
192
  /**
237
193
  * Removes all collections from the currently connected database.
238
194
  * Be careful with using this method and avoid using it in production or migrations
@@ -46,123 +46,111 @@ export class MongoQueryRunner {
46
46
  /**
47
47
  * Creates a cursor for a query that can be used to iterate over results from MongoDB.
48
48
  */
49
- cursor(collectionName, query) {
50
- return this.getCollection(collectionName).find(query || {});
49
+ cursor(collectionName, filter) {
50
+ return this.getCollection(collectionName).find(filter || {});
51
51
  }
52
52
  /**
53
53
  * Execute an aggregation framework pipeline against the collection.
54
54
  */
55
55
  aggregate(collectionName, pipeline, options) {
56
- return this.getCollection(collectionName).aggregate(pipeline, options);
56
+ return this.getCollection(collectionName).aggregate(pipeline, options || {});
57
57
  }
58
58
  /**
59
59
  * Perform a bulkWrite operation without a fluent API.
60
60
  */
61
61
  async bulkWrite(collectionName, operations, options) {
62
- return await this.getCollection(collectionName).bulkWrite(operations, options);
62
+ return await this.getCollection(collectionName).bulkWrite(operations, options || {});
63
63
  }
64
64
  /**
65
65
  * Count number of matching documents in the db to a query.
66
66
  */
67
- async count(collectionName, query, options) {
68
- return await this.getCollection(collectionName).countDocuments(query || {}, options);
67
+ async count(collectionName, filter, options) {
68
+ return this.getCollection(collectionName).count(filter || {}, options || {});
69
+ }
70
+ /**
71
+ * Count number of matching documents in the db to a query.
72
+ */
73
+ async countDocuments(collectionName, filter, options) {
74
+ return this.getCollection(collectionName).countDocuments(filter || {}, options || {});
69
75
  }
70
76
  /**
71
77
  * Creates an index on the db and collection.
72
78
  */
73
- async createCollectionIndex(collectionName, fieldOrSpec, options) {
74
- return await this.getCollection(collectionName).createIndex(fieldOrSpec, options);
79
+ async createCollectionIndex(collectionName, indexSpec, options) {
80
+ return this.getCollection(collectionName).createIndex(indexSpec, options || {});
75
81
  }
76
82
  /**
77
83
  * Creates multiple indexes in the collection, this method is only supported for MongoDB 2.6 or higher.
78
84
  * Earlier version of MongoDB will throw a command not supported error. Index specifications are defined at http://docs.mongodb.org/manual/reference/command/createIndexes/.
79
85
  */
80
86
  async createCollectionIndexes(collectionName, indexSpecs) {
81
- return await this.getCollection(collectionName).createIndexes(indexSpecs);
87
+ return this.getCollection(collectionName).createIndexes(indexSpecs);
82
88
  }
83
89
  /**
84
90
  * Delete multiple documents on MongoDB.
85
91
  */
86
- async deleteMany(collectionName, query, options) {
87
- return await this.getCollection(collectionName).deleteMany(query, options);
92
+ async deleteMany(collectionName, filter, options) {
93
+ return this.getCollection(collectionName).deleteMany(filter, options || {});
88
94
  }
89
95
  /**
90
96
  * Delete a document on MongoDB.
91
97
  */
92
- async deleteOne(collectionName, query, options) {
93
- return await this.getCollection(collectionName).deleteOne(query, options);
98
+ async deleteOne(collectionName, filter, options) {
99
+ return this.getCollection(collectionName).deleteOne(filter, options || {});
94
100
  }
95
101
  /**
96
102
  * The distinct command returns returns a list of distinct values for the given key across a collection.
97
103
  */
98
- async distinct(collectionName, key, query, options) {
99
- return await this.getCollection(collectionName).distinct(key, query, options);
104
+ async distinct(collectionName, key, filter, options) {
105
+ return this.getCollection(collectionName).distinct(key, filter, options || {});
100
106
  }
101
107
  /**
102
108
  * Drops an index from this collection.
103
109
  */
104
110
  async dropCollectionIndex(collectionName, indexName, options) {
105
- return await this.getCollection(collectionName).dropIndex(indexName, options);
111
+ return this.getCollection(collectionName).dropIndex(indexName, options || {});
106
112
  }
107
113
  /**
108
114
  * Drops all indexes from the collection.
109
115
  */
110
116
  async dropCollectionIndexes(collectionName) {
111
- return await this.getCollection(collectionName).dropIndexes();
117
+ return this.getCollection(collectionName).dropIndexes();
112
118
  }
113
119
  /**
114
120
  * Find a document and delete it in one atomic operation, requires a write lock for the duration of the operation.
115
121
  */
116
- async findOneAndDelete(collectionName, query, options) {
117
- return await this.getCollection(collectionName).findOneAndDelete(query, options);
122
+ async findOneAndDelete(collectionName, filter, options) {
123
+ return this.getCollection(collectionName).findOneAndDelete(filter, options || {});
118
124
  }
119
125
  /**
120
126
  * Find a document and replace it in one atomic operation, requires a write lock for the duration of the operation.
121
127
  */
122
- async findOneAndReplace(collectionName, query, replacement, options) {
123
- return await this.getCollection(collectionName).findOneAndReplace(query, replacement, options);
128
+ async findOneAndReplace(collectionName, filter, replacement, options) {
129
+ return this.getCollection(collectionName).findOneAndReplace(filter, replacement, options || {});
124
130
  }
125
131
  /**
126
132
  * Find a document and update it in one atomic operation, requires a write lock for the duration of the operation.
127
133
  */
128
- async findOneAndUpdate(collectionName, query, update, options) {
129
- return await this.getCollection(collectionName).findOneAndUpdate(query, update, options);
130
- }
131
- /**
132
- * Execute a geo search using a geo haystack index on a collection.
133
- */
134
- async geoHaystackSearch(collectionName, x, y, options) {
135
- return await this.getCollection(collectionName).geoHaystackSearch(x, y, options);
136
- }
137
- /**
138
- * Execute the geoNear command to search for items in the collection.
139
- */
140
- async geoNear(collectionName, x, y, options) {
141
- return await this.getCollection(collectionName).geoNear(x, y, options);
142
- }
143
- /**
144
- * Run a group command across a collection.
145
- */
146
- async group(collectionName, keys, condition, initial, reduce, finalize, command, options) {
147
- return await this.getCollection(collectionName).group(keys, condition, initial, reduce, finalize, command, options);
134
+ async findOneAndUpdate(collectionName, filter, update, options) {
135
+ return this.getCollection(collectionName).findOneAndUpdate(filter, update, options || {});
148
136
  }
149
137
  /**
150
138
  * Retrieve all the indexes on the collection.
151
139
  */
152
140
  async collectionIndexes(collectionName) {
153
- return await this.getCollection(collectionName).indexes();
141
+ return this.getCollection(collectionName).indexes();
154
142
  }
155
143
  /**
156
144
  * Retrieve all the indexes on the collection.
157
145
  */
158
146
  async collectionIndexExists(collectionName, indexes) {
159
- return await this.getCollection(collectionName).indexExists(indexes);
147
+ return this.getCollection(collectionName).indexExists(indexes);
160
148
  }
161
149
  /**
162
150
  * Retrieves this collections index info.
163
151
  */
164
152
  async collectionIndexInformation(collectionName, options) {
165
- return await this.getCollection(collectionName).indexInformation(options);
153
+ return this.getCollection(collectionName).indexInformation(options || {});
166
154
  }
167
155
  /**
168
156
  * Initiate an In order bulk write operation, operations will be serially executed in the order they are added, creating a new operation for each switch in types.
@@ -180,19 +168,19 @@ export class MongoQueryRunner {
180
168
  * Inserts an array of documents into MongoDB.
181
169
  */
182
170
  async insertMany(collectionName, docs, options) {
183
- return await this.getCollection(collectionName).insertMany(docs, options);
171
+ return this.getCollection(collectionName).insertMany(docs, options || {});
184
172
  }
185
173
  /**
186
174
  * Inserts a single document into MongoDB.
187
175
  */
188
176
  async insertOne(collectionName, doc, options) {
189
- return await this.getCollection(collectionName).insertOne(doc, options);
177
+ return this.getCollection(collectionName).insertOne(doc, options || {});
190
178
  }
191
179
  /**
192
180
  * Returns if the collection is a capped collection.
193
181
  */
194
182
  async isCapped(collectionName) {
195
- return await this.getCollection(collectionName).isCapped();
183
+ return this.getCollection(collectionName).isCapped();
196
184
  }
197
185
  /**
198
186
  * Get the list of all indexes information for the collection.
@@ -200,42 +188,23 @@ export class MongoQueryRunner {
200
188
  listCollectionIndexes(collectionName, options) {
201
189
  return this.getCollection(collectionName).listIndexes(options);
202
190
  }
203
- /**
204
- * Run Map Reduce across a collection. Be aware that the inline option for out will return an array of results not a collection.
205
- */
206
- async mapReduce(collectionName, map, reduce, options) {
207
- return await this.getCollection(collectionName).mapReduce(map, reduce, options);
208
- }
209
- /**
210
- * Return N number of parallel cursors for a collection allowing parallel reading of entire collection.
211
- * There are no ordering guarantees for returned results.
212
- */
213
- async parallelCollectionScan(collectionName, options) {
214
- return await this.getCollection(collectionName).parallelCollectionScan(options);
215
- }
216
- /**
217
- * Reindex all indexes on the collection Warning: reIndex is a blocking operation (indexes are rebuilt in the foreground) and will be slow for large collections.
218
- */
219
- async reIndex(collectionName) {
220
- return await this.getCollection(collectionName).reIndex();
221
- }
222
191
  /**
223
192
  * Reindex all indexes on the collection Warning: reIndex is a blocking operation (indexes are rebuilt in the foreground) and will be slow for large collections.
224
193
  */
225
194
  async rename(collectionName, newName, options) {
226
- return await this.getCollection(collectionName).rename(newName, options);
195
+ return this.getCollection(collectionName).rename(newName, options || {});
227
196
  }
228
197
  /**
229
198
  * Replace a document on MongoDB.
230
199
  */
231
- async replaceOne(collectionName, query, doc, options) {
232
- return await this.getCollection(collectionName).replaceOne(query, doc, options);
200
+ async replaceOne(collectionName, filter, replacement, options) {
201
+ return this.getCollection(collectionName).replaceOne(filter, replacement, options || {});
233
202
  }
234
203
  /**
235
204
  * Get all the collection statistics.
236
205
  */
237
206
  async stats(collectionName, options) {
238
- return await this.getCollection(collectionName).stats(options);
207
+ return this.getCollection(collectionName).stats(options || {});
239
208
  }
240
209
  /**
241
210
  * Watching new changes as stream.
@@ -246,14 +215,14 @@ export class MongoQueryRunner {
246
215
  /**
247
216
  * Update multiple documents on MongoDB.
248
217
  */
249
- async updateMany(collectionName, query, update, options) {
250
- return await this.getCollection(collectionName).updateMany(query, update, options);
218
+ async updateMany(collectionName, filter, update, options) {
219
+ return this.getCollection(collectionName).updateMany(filter, update, options || {});
251
220
  }
252
221
  /**
253
222
  * Update a single document on MongoDB.
254
223
  */
255
- async updateOne(collectionName, query, update, options) {
256
- return await this.getCollection(collectionName).updateOne(query, update, options);
224
+ async updateOne(collectionName, filter, update, options) {
225
+ return await this.getCollection(collectionName).updateOne(filter, update, options || {});
257
226
  }
258
227
  // -------------------------------------------------------------------------
259
228
  // Public Implemented Methods (from QueryRunner)