typeorm 0.3.6-dev.ea176b2 → 0.3.7-dev.ec23922

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 (143) hide show
  1. package/browser/driver/aurora-mysql/AuroraMysqlDriver.d.ts +1 -1
  2. package/browser/driver/aurora-mysql/AuroraMysqlDriver.js.map +1 -1
  3. package/browser/driver/expo/ExpoQueryRunner.js +8 -21
  4. package/browser/driver/expo/ExpoQueryRunner.js.map +1 -1
  5. package/browser/driver/mongodb/typings.d.ts +5 -5
  6. package/browser/driver/mongodb/typings.js.map +1 -1
  7. package/browser/driver/sqlserver/authentication/AzureActiveDirectoryAccessTokenAuthentication.d.ts +1 -1
  8. package/browser/driver/sqlserver/authentication/AzureActiveDirectoryAccessTokenAuthentication.js.map +1 -1
  9. package/browser/driver/sqlserver/authentication/AzureActiveDirectoryMsiAppServiceAuthentication.d.ts +2 -2
  10. package/browser/driver/sqlserver/authentication/AzureActiveDirectoryMsiAppServiceAuthentication.js.map +1 -1
  11. package/browser/driver/sqlserver/authentication/AzureActiveDirectoryMsiVmAuthentication.d.ts +2 -2
  12. package/browser/driver/sqlserver/authentication/AzureActiveDirectoryMsiVmAuthentication.js.map +1 -1
  13. package/browser/driver/sqlserver/authentication/AzureActiveDirectoryPasswordAuthentication.d.ts +2 -2
  14. package/browser/driver/sqlserver/authentication/AzureActiveDirectoryPasswordAuthentication.js.map +1 -1
  15. package/browser/entity-manager/EntityManager.js +1 -1
  16. package/browser/entity-manager/EntityManager.js.map +1 -1
  17. package/browser/entity-schema/EntitySchemaColumnOptions.d.ts +4 -0
  18. package/browser/entity-schema/EntitySchemaColumnOptions.js.map +1 -1
  19. package/browser/entity-schema/EntitySchemaOptions.d.ts +7 -0
  20. package/browser/entity-schema/EntitySchemaOptions.js.map +1 -1
  21. package/browser/entity-schema/EntitySchemaRelationIdOptions.d.ts +15 -0
  22. package/browser/entity-schema/EntitySchemaRelationIdOptions.js +3 -0
  23. package/browser/entity-schema/EntitySchemaRelationIdOptions.js.map +1 -0
  24. package/browser/entity-schema/EntitySchemaTransformer.js +15 -0
  25. package/browser/entity-schema/EntitySchemaTransformer.js.map +1 -1
  26. package/browser/find-options/FindOptionsWhere.d.ts +1 -1
  27. package/browser/find-options/FindOptionsWhere.js.map +1 -1
  28. package/browser/index.d.ts +2 -0
  29. package/browser/index.js.map +1 -1
  30. package/browser/metadata/EntityMetadata.js +1 -1
  31. package/browser/metadata/EntityMetadata.js.map +1 -1
  32. package/browser/metadata-args/RelationIdMetadataArgs.d.ts +1 -1
  33. package/browser/metadata-args/RelationIdMetadataArgs.js.map +1 -1
  34. package/browser/migration/MigrationExecutor.js +1 -1
  35. package/browser/migration/MigrationExecutor.js.map +1 -1
  36. package/browser/persistence/SubjectDatabaseEntityLoader.d.ts +1 -1
  37. package/browser/persistence/SubjectDatabaseEntityLoader.js +1 -1
  38. package/browser/persistence/SubjectDatabaseEntityLoader.js.map +1 -1
  39. package/browser/persistence/SubjectExecutor.js +1 -1
  40. package/browser/persistence/SubjectExecutor.js.map +1 -1
  41. package/browser/persistence/subject-builder/CascadesSubjectBuilder.d.ts +1 -1
  42. package/browser/persistence/subject-builder/CascadesSubjectBuilder.js +1 -1
  43. package/browser/persistence/subject-builder/CascadesSubjectBuilder.js.map +1 -1
  44. package/browser/persistence/subject-builder/ManyToManySubjectBuilder.js +1 -1
  45. package/browser/persistence/subject-builder/ManyToManySubjectBuilder.js.map +1 -1
  46. package/browser/persistence/subject-builder/OneToOneInverseSideSubjectBuilder.js +1 -1
  47. package/browser/persistence/subject-builder/OneToOneInverseSideSubjectBuilder.js.map +1 -1
  48. package/browser/query-builder/QueryBuilder.d.ts +1 -1
  49. package/browser/query-builder/QueryBuilder.js +15 -15
  50. package/browser/query-builder/QueryBuilder.js.map +1 -1
  51. package/browser/query-builder/QueryExpressionMap.d.ts +1 -1
  52. package/browser/query-builder/QueryExpressionMap.js +1 -1
  53. package/browser/query-builder/QueryExpressionMap.js.map +1 -1
  54. package/browser/query-builder/ReturningResultsEntityUpdator.js +2 -2
  55. package/browser/query-builder/ReturningResultsEntityUpdator.js.map +1 -1
  56. package/browser/schema-builder/options/TableForeignKeyOptions.d.ts +1 -1
  57. package/browser/schema-builder/options/TableForeignKeyOptions.js.map +1 -1
  58. package/browser/util/OrmUtils.d.ts +1 -1
  59. package/browser/util/OrmUtils.js +4 -4
  60. package/browser/util/OrmUtils.js.map +1 -1
  61. package/browser/util/escapeRegExp.d.ts +1 -0
  62. package/browser/util/escapeRegExp.js +6 -0
  63. package/browser/util/escapeRegExp.js.map +1 -0
  64. package/commands/CacheClearCommand.js +1 -1
  65. package/commands/CacheClearCommand.js.map +1 -1
  66. package/commands/InitCommand.js +24 -4
  67. package/commands/InitCommand.js.map +1 -1
  68. package/commands/MigrationRevertCommand.js +1 -1
  69. package/commands/MigrationRevertCommand.js.map +1 -1
  70. package/commands/MigrationRunCommand.js +1 -1
  71. package/commands/MigrationRunCommand.js.map +1 -1
  72. package/commands/MigrationShowCommand.js +1 -1
  73. package/commands/MigrationShowCommand.js.map +1 -1
  74. package/commands/QueryCommand.js +1 -1
  75. package/commands/QueryCommand.js.map +1 -1
  76. package/commands/SchemaDropCommand.js +1 -1
  77. package/commands/SchemaDropCommand.js.map +1 -1
  78. package/commands/SchemaSyncCommand.js +1 -1
  79. package/commands/SchemaSyncCommand.js.map +1 -1
  80. package/driver/aurora-mysql/AuroraMysqlDriver.d.ts +1 -1
  81. package/driver/aurora-mysql/AuroraMysqlDriver.js.map +1 -1
  82. package/driver/expo/ExpoQueryRunner.js +8 -21
  83. package/driver/expo/ExpoQueryRunner.js.map +1 -1
  84. package/driver/mongodb/typings.d.ts +5 -5
  85. package/driver/mongodb/typings.js.map +1 -1
  86. package/driver/sqlserver/authentication/AzureActiveDirectoryAccessTokenAuthentication.d.ts +1 -1
  87. package/driver/sqlserver/authentication/AzureActiveDirectoryAccessTokenAuthentication.js.map +1 -1
  88. package/driver/sqlserver/authentication/AzureActiveDirectoryMsiAppServiceAuthentication.d.ts +2 -2
  89. package/driver/sqlserver/authentication/AzureActiveDirectoryMsiAppServiceAuthentication.js.map +1 -1
  90. package/driver/sqlserver/authentication/AzureActiveDirectoryMsiVmAuthentication.d.ts +2 -2
  91. package/driver/sqlserver/authentication/AzureActiveDirectoryMsiVmAuthentication.js.map +1 -1
  92. package/driver/sqlserver/authentication/AzureActiveDirectoryPasswordAuthentication.d.ts +2 -2
  93. package/driver/sqlserver/authentication/AzureActiveDirectoryPasswordAuthentication.js.map +1 -1
  94. package/entity-manager/EntityManager.js +1 -1
  95. package/entity-manager/EntityManager.js.map +1 -1
  96. package/entity-schema/EntitySchemaColumnOptions.d.ts +4 -0
  97. package/entity-schema/EntitySchemaColumnOptions.js.map +1 -1
  98. package/entity-schema/EntitySchemaOptions.d.ts +7 -0
  99. package/entity-schema/EntitySchemaOptions.js.map +1 -1
  100. package/entity-schema/EntitySchemaRelationIdOptions.d.ts +15 -0
  101. package/entity-schema/EntitySchemaRelationIdOptions.js +4 -0
  102. package/entity-schema/EntitySchemaRelationIdOptions.js.map +1 -0
  103. package/entity-schema/EntitySchemaTransformer.js +15 -0
  104. package/entity-schema/EntitySchemaTransformer.js.map +1 -1
  105. package/find-options/FindOptionsWhere.d.ts +1 -1
  106. package/find-options/FindOptionsWhere.js.map +1 -1
  107. package/index.d.ts +2 -0
  108. package/index.js.map +1 -1
  109. package/metadata/EntityMetadata.js +1 -1
  110. package/metadata/EntityMetadata.js.map +1 -1
  111. package/metadata-args/RelationIdMetadataArgs.d.ts +1 -1
  112. package/metadata-args/RelationIdMetadataArgs.js.map +1 -1
  113. package/migration/MigrationExecutor.js +1 -1
  114. package/migration/MigrationExecutor.js.map +1 -1
  115. package/package.json +1 -1
  116. package/persistence/SubjectDatabaseEntityLoader.d.ts +1 -1
  117. package/persistence/SubjectDatabaseEntityLoader.js +1 -1
  118. package/persistence/SubjectDatabaseEntityLoader.js.map +1 -1
  119. package/persistence/SubjectExecutor.js +1 -1
  120. package/persistence/SubjectExecutor.js.map +1 -1
  121. package/persistence/subject-builder/CascadesSubjectBuilder.d.ts +1 -1
  122. package/persistence/subject-builder/CascadesSubjectBuilder.js +1 -1
  123. package/persistence/subject-builder/CascadesSubjectBuilder.js.map +1 -1
  124. package/persistence/subject-builder/ManyToManySubjectBuilder.js +1 -1
  125. package/persistence/subject-builder/ManyToManySubjectBuilder.js.map +1 -1
  126. package/persistence/subject-builder/OneToOneInverseSideSubjectBuilder.js +1 -1
  127. package/persistence/subject-builder/OneToOneInverseSideSubjectBuilder.js.map +1 -1
  128. package/query-builder/QueryBuilder.d.ts +1 -1
  129. package/query-builder/QueryBuilder.js +15 -15
  130. package/query-builder/QueryBuilder.js.map +1 -1
  131. package/query-builder/QueryExpressionMap.d.ts +1 -1
  132. package/query-builder/QueryExpressionMap.js +1 -1
  133. package/query-builder/QueryExpressionMap.js.map +1 -1
  134. package/query-builder/ReturningResultsEntityUpdator.js +2 -2
  135. package/query-builder/ReturningResultsEntityUpdator.js.map +1 -1
  136. package/schema-builder/options/TableForeignKeyOptions.d.ts +1 -1
  137. package/schema-builder/options/TableForeignKeyOptions.js.map +1 -1
  138. package/util/OrmUtils.d.ts +1 -1
  139. package/util/OrmUtils.js +4 -4
  140. package/util/OrmUtils.js.map +1 -1
  141. package/util/escapeRegExp.d.ts +1 -0
  142. package/util/escapeRegExp.js +10 -0
  143. package/util/escapeRegExp.js.map +1 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/driver/mongodb/typings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA","file":"typings.js","sourcesContent":["import { EventEmitter, Readable, Writable } from \"../../platform/PlatformTools\"\n\n/**\n * Creates a new MongoClient instance.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/MongoClient.html\n */\nexport declare class MongoClient extends EventEmitter {\n constructor(uri: string, options?: MongoClientOptions)\n\n /**\n * Connect to MongoDB using a url as documented at docs.mongodb.org/manual/reference/connection-string/\n * Note that for replicasets the replicaSet query parameter is required in the 2.0 driver.\n *\n * @param url The connection URI string.\n * @param callback The command result callback.\n */\n static connect(url: string, callback: MongoCallback<Db>): void\n\n /**\n * Connect to MongoDB using a url as documented at docs.mongodb.org/manual/reference/connection-string/\n * Note that for replicasets the replicaSet query parameter is required in the 2.0 driver.\n *\n * @param url The connection URI string.\n * @param options Optional settings.\n */\n static connect(url: string, options?: MongoClientOptions): Promise<Db>\n\n /**\n * Connect to MongoDB using a url as documented at docs.mongodb.org/manual/reference/connection-string/\n * Note that for replicasets the replicaSet query parameter is required in the 2.0 driver.\n *\n * @param url The connection URI string.\n * @param options Optional settings.\n * @param callback The command result callback.\n */\n static connect(\n url: string,\n options: MongoClientOptions,\n callback: MongoCallback<Db>,\n ): void\n\n /**\n * Connect to MongoDB using a url as documented at docs.mongodb.org/manual/reference/connection-string/\n * Note that for replicasets the replicaSet query parameter is required in the 2.0 driver.\n */\n connect(): Promise<MongoClient>\n\n /**\n * Connect to MongoDB using a url as documented at docs.mongodb.org/manual/reference/connection-string/\n * Note that for replicasets the replicaSet query parameter is required in the 2.0 driver.\n *\n * @param url The connection URI string.\n * @param callback The command result callback.\n */\n connect(url: string, callback: MongoCallback<Db>): void\n\n /**\n * Connect to MongoDB using a url as documented at docs.mongodb.org/manual/reference/connection-string/\n * Note that for replicasets the replicaSet query parameter is required in the 2.0 driver.\n *\n * @param url The connection URI string.\n * @param options Optional settings.\n */\n connect(url: string, options?: MongoClientOptions): Promise<Db>\n\n /**\n * Connect to MongoDB using a url as documented at docs.mongodb.org/manual/reference/connection-string/\n * Note that for replicasets the replicaSet query parameter is required in the 2.0 driver.\n *\n * @param url The connection URI string.\n * @param options Optional settings.\n * @param callback The command result callback.\n */\n connect(\n url: string,\n options: MongoClientOptions,\n callback: MongoCallback<Db>,\n ): void\n\n /**\n * Close the db and its underlying connections.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/MongoClient.html#close\n */\n close(callback: MongoCallback<void>): void\n\n /**\n * Close the db and its underlying connections.\n * @param force Force close, emitting no events.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/MongoClient.html#close\n */\n close(force?: boolean): Promise<void>\n\n /**\n * Close the db and its underlying connections.\n * @param force Force close, emitting no events.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/MongoClient.html#close\n */\n close(force: boolean, callback: MongoCallback<void>): void\n\n /**\n * Create a new Db instance sharing the current socket connections. Be aware that the new db instances are\n * related in a parent-child relationship to the original instance so that events are correctly emitted on child\n * db instances. Child db instances are cached so performing db('db1') twice will return the same instance.\n * You can control these behaviors with the options noListener and returnNonCachedInstance.\n * @param dbName The name of the database we want to use. If not provided, use database name from connection string.\n * @param options Optional settings.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/MongoClient.html#db\n */\n db(dbName?: string, options?: MongoClientCommonOption): Db\n\n /**\n * Check if MongoClient is connected.\n * @param options Optional settings.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/MongoClient.html#isConnected\n */\n isConnected(options?: MongoClientCommonOption): boolean\n\n /**\n * Logout user from server, fire off on all connections and remove all auth info.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/MongoClient.html#logout\n */\n logout(callback: MongoCallback<any>): void\n logout(options?: { dbName?: string }): Promise<any>\n logout(options: { dbName?: string }, callback: MongoCallback<any>): void\n\n /**\n * Starts a new session on the server.\n * @param options Optional settings.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/MongoClient.html#startSession\n */\n startSession(options?: SessionOptions): ClientSession\n\n /**\n * Create a new Change Stream, watching for new changes (insertions, updates, replacements, deletions, and invalidations) in this cluster.\n * Will ignore all changes to system collections, as well as the local, admin, and config databases.\n * @param pipeline An array of aggregation pipeline stages through which to pass change stream documents. This allows for filtering (using $match) and manipulating the change stream documents.\n * @param options Optional settings.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#watch\n */\n watch(\n pipeline?: Object[],\n options?: ChangeStreamOptions & {\n startAtClusterTime?: Timestamp\n session?: ClientSession\n },\n ): ChangeStream\n\n /**\n * Runs a given operation with an implicitly created session. The lifetime of the session will be handled without the need for user interaction.\n * @param operation An operation to execute with an implicitly created session. The signature of this MUST be `(session) => {}`\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/MongoClient.html#withSession\n */\n withSession(\n operation: (session: ClientSession) => Promise<any>,\n ): Promise<void>\n\n /**\n * Runs a given operation with an implicitly created session. The lifetime of the session will be handled without the need for user interaction.\n * @param options Optional settings to be appled to implicitly created session.\n * @param operation An operation to execute with an implicitly created session. The signature of this MUST be `(session) => {}`\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/MongoClient.html#withSession\n */\n withSession(\n options: SessionOptions,\n operation: (session: ClientSession) => Promise<any>,\n ): Promise<void>\n}\n\n/**\n * The callback format for results.\n */\nexport interface MongoCallback<T> {\n /**\n * @param error An error instance representing the error during the execution.\n * @param result The result of execution.\n */\n (error: MongoError, result: T): void\n}\n\n// http://mongodb.github.io/node-mongodb-native/2.1/api/MongoError.html\nexport declare class MongoError extends Error {\n constructor(message: string)\n static create(options: Object): MongoError\n}\n\n/**\n * Options for MongoClient#connect method.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.2/api/MongoClient.html#.connect\n */\nexport interface MongoClientOptions {\n /**\n * The maximum size of the individual server pool.\n */\n poolSize?: number\n\n /**\n * Enable SSL connection.\n */\n ssl?: boolean\n\n /**\n * SSL Certificate store binary buffer.\n */\n sslCA?: Buffer\n\n /**\n * Uri decode the user name and password for authentication.\n */\n uri_decode_auth?: boolean\n\n /**\n * A hash of options to set on the db object, see Db constructor.\n */\n db?: DbCreateOptions\n\n /**\n * A hash of options to set on the server objects, see Server constructor**.\n */\n server?: ServerOptions\n\n /**\n * A hash of options to set on the replSet object, see ReplSet constructor**.\n */\n replSet?: ReplSetOptions\n\n /**\n * A hash of options to set on the mongos object, see Mongos constructor**.\n */\n mongos?: MongosOptions\n\n /**\n * A Promise library class the application wishes to use such as Bluebird, must be ES6 compatible.\n */\n promiseLibrary?: Object\n}\n\nexport interface CommandOptions {\n /**\n * The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED,\n * ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).\n */\n readPreference?: ReadPreference | string\n\n /**\n * Number of milliseconds to wait before aborting the query.\n */\n maxTimeMS?: number\n}\n\n/**\n * Options for Db class.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html\n */\nexport interface DbCreateOptions {\n /**\n * If the database authentication is dependent on another databaseName.\n */\n authSource?: string\n\n /**\n * The write concern.\n */\n w?: number | string\n\n /**\n * The write concern timeout.\n */\n wtimeout?: number\n\n /**\n * Specify a journal write concern.\n */\n j?: boolean\n\n /**\n * The current value of the parameter native_parser.\n */\n native_parser?: boolean\n\n /**\n * Force server to assign _id values instead of driver.\n */\n forceServerObjectId?: boolean\n\n /**\n * Serialize functions on any object.\n */\n serializeFunctions?: boolean\n\n /**\n * Specify if the BSON serializer should ignore undefined fields.\n */\n ignoreUndefined?: boolean\n\n /**\n * Return document results as raw BSON buffers.\n */\n raw?: boolean\n\n /**\n * Promotes Long values to number if they fit inside the 53 bits resolution.\n */\n promoteLongs?: boolean\n\n /**\n * Sets a cap on how many operations the driver will buffer up before giving up on getting a working connection, default is -1 which is unlimited.\n */\n bufferMaxEntries?: number\n\n /**\n * The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).\n */\n readPreference?: ReadPreference | string\n\n /**\n * A primary key factory object for generation of custom _id keys.\n */\n pkFactory?: Object\n\n /**\n * A Promise library class the application wishes to use such as Bluebird, must be ES6 compatible.\n */\n promiseLibrary?: Object\n\n /**\n * Specify a read concern for the collection. (only MongoDB 3.2 or higher supported).\n */\n readConcern?: ReadConcern\n}\n\n/**\n * Creates a new ReadPreference instance.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/ReadPreference.html\n */\nexport declare class ReadPreference {\n constructor(mode: string, tags: Object)\n\n /**\n * The ReadPreference mode as listed above.\n */\n mode: string\n\n /**\n * An object representing read preference tags.\n */\n tags: any\n\n /**\n * Read from primary only. All operations produce an error (throw an exception where applicable) if primary is unavailable. Cannot be combined with tags (This is the default.).\n */\n static PRIMARY: string\n\n /**\n * Read from primary if available, otherwise a secondary.\n */\n static PRIMARY_PREFERRED: string\n\n /**\n * Read from secondary if available, otherwise error.\n */\n static SECONDARY: string\n\n /**\n * Read from a secondary if available, otherwise read from the primary.\n */\n static SECONDARY_PREFERRED: string\n\n /**\n * All modes read from among the nearest candidates, but unlike other modes, NEAREST will include both the primary and all secondaries in the random selection.\n */\n static NEAREST: string\n\n /**\n * Validate if a mode is legal.\n */\n isValid(mode: string): boolean\n\n /**\n * Validate if a mode is legal.\n */\n static isValid(mode: string): boolean\n}\n\n/**\n * Creates a new Server instance.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Server.html\n */\nexport interface SocketOptions {\n /**\n * Reconnect on error.\n */\n autoReconnect?: boolean\n\n /**\n * TCP Socket NoDelay option.\n */\n noDelay?: boolean\n\n /**\n * TCP KeepAlive on the socket with a X ms delay before start.\n */\n keepAlive?: number\n\n /**\n * TCP Connection timeout setting.\n */\n connectTimeoutMS?: number\n\n /**\n * TCP Socket timeout setting.\n */\n socketTimeoutMS?: number\n}\n\n/**\n * Creates a new Server instance.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Server.html\n */\nexport interface ServerOptions {\n /**\n * Number of connections in the connection pool for each server instance, set to 5 as default for legacy reasons.\n */\n poolSize?: number\n\n /**\n * Use ssl connection (needs to have a mongod server with ssl support).\n */\n ssl?: boolean\n\n /**\n * Validate mongod server certificate against ca (needs to have a mongod server with ssl support, 2.4 or higher).\n */\n sslValidate?: Object\n\n /**\n * Ensure we check server identify during SSL, set to false to disable checking. Only works for Node 0.12.x or higher. You can pass in a boolean or your own checkServerIdentity override function.\n */\n checkServerIdentity?: boolean | Function\n\n /**\n * Array of valid certificates either as Buffers or Strings (needs to have a mongod server with ssl support, 2.4 or higher).\n */\n sslCA?: Array<Buffer | string>\n\n /**\n * String or buffer containing the certificate we wish to present (needs to have a mongod server with ssl support, 2.4 or higher).\n */\n sslCert?: Buffer | string\n\n /**\n * String or buffer containing the certificate private key we wish to present (needs to have a mongod server with ssl support, 2.4 or higher).\n */\n sslKey?: Buffer | string\n\n /**\n * String or buffer containing the certificate password (needs to have a mongod server with ssl support, 2.4 or higher).\n */\n sslPass?: Buffer | string\n\n /**\n * Socket options.\n */\n socketOptions?: SocketOptions\n\n /**\n * Server attempt to reconnect #times.\n */\n reconnectTries?: number\n\n /**\n * Server will wait # milliseconds between retries.\n */\n reconnectInterval?: number\n}\n\n/**\n * Creates a new ReplSet instance.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/ReplSet.html\n */\nexport interface ReplSetOptions {\n /**\n * Turn on high availability monitoring.\n */\n ha?: boolean\n\n /**\n * Time between each replicaset status check.\n */\n haInterval?: number\n\n /**\n * The name of the replicaset to connect to.\n */\n replicaSet?: string\n\n /**\n * Sets the range of servers to pick when using NEAREST (lowest ping ms + the latency fence, ex: range of 1 to (1 + 15) ms).\n */\n secondaryAcceptableLatencyMS?: number\n\n /**\n * Sets if the driver should connect even if no primary is available.\n */\n connectWithNoPrimary?: boolean\n\n /**\n * Number of connections in the connection pool for each server instance, set to 5 as default for legacy reasons.\n */\n poolSize?: number\n\n /**\n * Use ssl connection (needs to have a mongod server with ssl support).\n */\n ssl?: boolean\n\n /**\n * Validate mongod server certificate against ca (needs to have a mongod server with ssl support, 2.4 or higher).\n */\n sslValidate?: Object\n\n /**\n * Ensure we check server identify during SSL, set to false to disable checking. Only works for Node 0.12.x or higher. You can pass in a boolean or your own checkServerIdentity override function.\n */\n checkServerIdentity?: boolean | Function\n\n /**\n * Array of valid certificates either as Buffers or Strings (needs to have a mongod server with ssl support, 2.4 or higher).\n */\n sslCA?: Array<Buffer | string>\n\n /**\n * String or buffer containing the certificate we wish to present (needs to have a mongod server with ssl support, 2.4 or higher).\n */\n sslCert?: Buffer | string\n\n /**\n * String or buffer containing the certificate private key we wish to present (needs to have a mongod server with ssl support, 2.4 or higher).\n */\n sslKey?: Buffer | string\n\n /**\n * String or buffer containing the certificate private key we wish to present (needs to have a mongod server with ssl support, 2.4 or higher).\n */\n sslPass?: Buffer | string\n\n /**\n * Socket options.\n */\n socketOptions?: SocketOptions\n}\n\n/**\n * Creates a new Mongos instance.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Mongos.html\n */\nexport interface MongosOptions {\n /**\n * Turn on high availability monitoring.\n */\n ha?: boolean\n\n /**\n * Time between each replicaset status check.\n */\n haInterval?: number\n\n /**\n * Number of connections in the connection pool for each server instance, set to 5 as default for legacy reasons.\n */\n poolSize?: number\n\n /**\n * Use ssl connection (needs to have a mongod server with ssl support).\n */\n ssl?: boolean\n\n /**\n * Validate mongod server certificate against ca (needs to have a mongod server with ssl support, 2.4 or higher).\n */\n sslValidate?: Object\n\n /**\n * Ensure we check server identify during SSL, set to false to disable checking. Only works for Node 0.12.x or higher. You can pass in a boolean or your own checkServerIdentity override function.\n */\n checkServerIdentity?: boolean | Function\n\n /**\n * Array of valid certificates either as Buffers or Strings (needs to have a mongod server with ssl support, 2.4 or higher).\n */\n sslCA?: Array<Buffer | string>\n\n /**\n * String or buffer containing the certificate we wish to present (needs to have a mongod server with ssl support, 2.4 or higher).\n */\n sslCert?: Buffer | string\n\n /**\n * String or buffer containing the certificate private key we wish to present (needs to have a mongod server with ssl support, 2.4 or higher).\n */\n sslKey?: Buffer | string\n\n /**\n * String or buffer containing the certificate password (needs to have a mongod server with ssl support, 2.4 or higher).\n */\n sslPass?: Buffer | string\n\n /**\n * Socket options.\n */\n socketOptions?: SocketOptions\n}\n\nexport interface DbOptions {\n /**\n * Do not make the db an event listener to the original connection.\n */\n noListener?: boolean\n\n /**\n * Control if you want to return a cached instance or have a new one created.\n */\n returnNonCachedInstance?: boolean\n}\n\nexport interface IndexInformationOptions {\n /**\n * Returns the full raw index information.\n */\n full?: boolean\n\n /**\n * The preferred read preference (ReadPreference.PRIMARY,\n * ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY,\n * ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).\n */\n readPreference?: ReadPreference | string\n}\n\nexport interface ExecuteDbAdminCommandOptions {\n /**\n * The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED,\n * ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).\n */\n readPreference?: ReadPreference | string\n\n // maxTimeMS?: number;\n}\n\nexport interface ListCollectionsOptions {\n /**\n * The batchSize for the returned command cursor or if pre 2.8 the systems batch collection.\n */\n batchSize?: number\n\n /**\n * The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED,\n * ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).\n */\n readPreference?: ReadPreference | string\n}\n\n/**\n * Db.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html\n */\nexport declare class Db extends EventEmitter {\n /**\n *\n * @param databaseName The name of the database this instance represents.\n * @param serverConfig The server topology for the database.\n * @param options Optional.\n */\n constructor(\n databaseName: string,\n serverConfig: Server | ReplSet | Mongos,\n options?: DbCreateOptions,\n )\n\n /**\n * Get the current db topology.\n */\n serverConfig: Server | ReplSet | Mongos\n\n /**\n * Current bufferMaxEntries value for the database.\n */\n bufferMaxEntries: number\n\n /**\n * The name of the database this instance represents.\n */\n databaseName: string\n\n /**\n * The options associated with the db instance.\n */\n options: any\n\n /**\n * The current value of the parameter native_parser.\n */\n native_parser: boolean\n\n /**\n * The current slaveOk value for the db instance.\n */\n slaveOk: boolean\n\n /**\n * The current write concern values.\n */\n writeConcern: WriteConcern\n\n /**\n * Add a user to the database.\n *\n * @param username The username.\n * @param password The password.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#addUser\n */\n addUser(\n username: string,\n password: string,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Add a user to the database.\n *\n * @param username The username.\n * @param password The password.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#addUser\n */\n addUser(\n username: string,\n password: string,\n options?: DbAddUserOptions,\n ): Promise<any>\n\n /**\n * Add a user to the database.\n *\n * @param username The username.\n * @param password The password.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#addUser\n */\n addUser(\n username: string,\n password: string,\n options: DbAddUserOptions,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Return the Admin db instance.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#admin\n */\n admin(): Admin\n\n /**\n * Authenticate a user against the server.\n *\n * @param userName The username.\n * @param password The password.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#authenticate\n */\n authenticate(\n userName: string,\n password: string,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Authenticate a user against the server.\n *\n * @param userName The username.\n * @param password The password.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#authenticate\n */\n authenticate(\n userName: string,\n password: string,\n options?: { authMechanism: string },\n ): Promise<any>\n\n /**\n * Authenticate a user against the server.\n *\n * @param userName The username.\n * @param password The password.\n * @param password\n * @param options\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#authenticate\n */\n authenticate(\n userName: string,\n password: string,\n options: { authMechanism: string },\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Close the db and its underlying connections.\n *\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#close\n */\n close(callback: MongoCallback<void>): void\n\n /**\n * Close the db and its underlying connections.\n *\n * @param forceClose Force close, emitting no events.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#close\n */\n close(forceClose?: boolean): Promise<void>\n\n /**\n * Close the db and its underlying connections.\n *\n * @param forceClose Force close, emitting no events.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#close\n */\n close(forceClose: boolean, callback: MongoCallback<void>): void\n\n /**\n * Fetch a specific collection (containing the actual collection information). If the application does not use strict mode you can\n * can use it without a callback in the following way: var collection = db.collection('mycollection');\n *\n * @param name The collection name we wish to access.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#collection\n */\n collection(name: string): Collection<any>\n\n /**\n * Fetch a specific collection (containing the actual collection information). If the application does not use strict mode you can\n * can use it without a callback in the following way: var collection = db.collection('mycollection');\n *\n * @param name The collection name we wish to access.\n * @param callback The collection result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#collection\n */\n collection(\n name: string,\n callback: MongoCallback<Collection<any>>,\n ): Collection<any>\n\n /**\n * Fetch a specific collection (containing the actual collection information). If the application does not use strict mode you can\n * can use it without a callback in the following way: var collection = db.collection('mycollection');\n *\n * @param name The collection name we wish to access.\n * @param options Optional settings.\n * @param callback The collection result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#collection\n */\n collection(\n name: string,\n options: DbCollectionOptions,\n callback: MongoCallback<Collection<any>>,\n ): Collection<any>\n\n /**\n * Fetch all collections for the current db.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#collections\n */\n collections(): Promise<Collection<any>[]>\n\n /**\n * Fetch all collections for the current db.\n *\n * @param callback The results callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#collections\n */\n collections(callback: MongoCallback<Collection<any>[]>): void\n\n /**\n * Execute a command.\n *\n * @param command The command hash.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#command\n */\n command(command: Object, callback: MongoCallback<any>): void\n\n /**\n * Execute a command.\n *\n * @param command The command hash.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#command\n */\n command(\n command: Object,\n options?: { readPreference: ReadPreference | string },\n ): Promise<any>\n\n /**\n * Execute a command.\n *\n * @param command The command hash.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#command\n */\n command(\n command: Object,\n options: { readPreference: ReadPreference | string },\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Create a new collection on a server with the specified options. Use this to create capped collections.\n *\n * @param name The collection name we wish to access.\n * @param callback The results callback\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#createCollection\n */\n createCollection(\n name: string,\n callback: MongoCallback<Collection<any>>,\n ): void\n\n /**\n * Create a new collection on a server with the specified options. Use this to create capped collections.\n *\n * @param name The collection name we wish to access.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#createCollection\n */\n createCollection(\n name: string,\n options?: CollectionCreateOptions,\n ): Promise<Collection<any>>\n\n /**\n * Create a new collection on a server with the specified options. Use this to create capped collections.\n *\n * @param name The collection name we wish to access.\n * @param options Optional settings.\n * @param callback The results callback\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#createCollection\n */\n createCollection(\n name: string,\n options: CollectionCreateOptions,\n callback: MongoCallback<Collection<any>>,\n ): void\n\n /**\n * Creates an index on the db and collection collection.\n *\n * @param name Name of the collection to create the index on.\n * @param fieldOrSpec Defines the index.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#createIndex\n */\n createIndex(\n name: string,\n fieldOrSpec: string | Object,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Creates an index on the db and collection collection.\n *\n * @param name Name of the collection to create the index on.\n * @param fieldOrSpec Defines the index.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#createIndex\n */\n createIndex(\n name: string,\n fieldOrSpec: string | Object,\n options?: MongodbIndexOptions,\n ): Promise<any>\n\n /**\n * Creates an index on the db and collection collection.\n *\n * @param name Name of the collection to create the index on.\n * @param fieldOrSpec Defines the index.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#createIndex\n */\n createIndex(\n name: string,\n fieldOrSpec: string | Object,\n options: MongodbIndexOptions,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Create a new Db instance sharing the current socket connections. Be aware that the new db instances are\n * related in a parent-child relationship to the original instance so that events are correctly emitted on child\n * db instances. Child db instances are cached so performing db('db1') twice will return the same instance.\n * You can control these behaviors with the options noListener and returnNonCachedInstance.\n *\n * @param dbName The name of the database we want to use.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#db\n */\n db(dbName: string): Db\n\n /**\n * Create a new Db instance sharing the current socket connections. Be aware that the new db instances are\n * related in a parent-child relationship to the original instance so that events are correctly emitted on child\n * db instances. Child db instances are cached so performing db('db1') twice will return the same instance.\n * You can control these behaviors with the options noListener and returnNonCachedInstance.\n *\n * @param dbName The name of the database we want to use.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#db\n */\n db(dbName: string, options: DbOptions): Db\n\n /**\n * Drop a collection from the database, removing it permanently. New accesses will create a new collection.\n *\n * @param name Name of collection to drop.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#dropCollection\n */\n dropCollection(name: string): Promise<boolean>\n\n /**\n * Drop a collection from the database, removing it permanently. New accesses will create a new collection.\n *\n * @param name Name of collection to drop.\n * @param callback The results callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#dropCollection\n */\n dropCollection(name: string, callback: MongoCallback<boolean>): void\n\n /**\n * Drop a database, removing it permanently from the server.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#dropDatabase\n */\n dropDatabase(): Promise<any>\n\n /**\n * Drop a database, removing it permanently from the server.\n *\n * @param callback The results callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#dropDatabase\n */\n dropDatabase(callback: MongoCallback<any>): void\n\n // deprecated http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#ensureIndex\n // ensureIndex(collectionName: any, fieldOrSpec: any, options: IndexOptions, callback: Function): void;\n // deprecated http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#eval\n // eval(code: any, parameters: any[], options?: any, callback?: MongoCallback<any>): void;\n\n /**\n * Runs a command on the database as admin.\n *\n * @param command The command hash.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#executeDbAdminCommand\n */\n executeDbAdminCommand(command: Object, callback: MongoCallback<any>): void\n\n /**\n * Runs a command on the database as admin.\n *\n * @param command The command hash.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#executeDbAdminCommand\n */\n executeDbAdminCommand(\n command: Object,\n options?: ExecuteDbAdminCommandOptions,\n ): Promise<any>\n\n /**\n * Runs a command on the database as admin.\n *\n * @param command The command hash.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#executeDbAdminCommand\n */\n executeDbAdminCommand(\n command: Object,\n options: ExecuteDbAdminCommandOptions,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Retrieves this collections index info.\n *\n * @param name The name of the collection.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#indexInformation\n */\n indexInformation(name: string, callback: MongoCallback<any>): void\n\n /**\n * Retrieves this collections index info.\n *\n * @param name The name of the collection.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#indexInformation\n */\n indexInformation(\n name: string,\n options?: IndexInformationOptions,\n ): Promise<any>\n\n /**\n * Retrieves this collections index info.\n *\n * @param name The name of the collection.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#indexInformation\n */\n indexInformation(\n name: string,\n options: IndexInformationOptions,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Get the list of all collection information for the specified db.\n *\n * @param filter Query to filter collections by.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#listCollections\n */\n listCollections(\n filter: Object,\n options?: ListCollectionsOptions,\n ): CommandCursor\n\n /**\n * Logout user from server, fire off on all connections and remove all auth info.\n *\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#logout\n */\n logout(callback: MongoCallback<any>): void\n\n /**\n * Logout user from server, fire off on all connections and remove all auth info.\n *\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#logout\n */\n logout(options?: { dbName?: string }): Promise<any>\n\n /**\n * Logout user from server, fire off on all connections and remove all auth info.\n *\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#logout\n */\n logout(options: { dbName?: string }, callback: MongoCallback<any>): void\n\n /**\n * Open the database.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#open\n */\n open(): Promise<Db>\n\n /**\n * Open the database\n *\n * @param callback Callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#open\n */\n open(callback: MongoCallback<Db>): void\n\n /**\n *\n * @param username\n * @param callback\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#removeUser\n */\n removeUser(username: string, callback: MongoCallback<any>): void\n removeUser(\n username: string,\n options?: { w?: number | string; wtimeout?: number; j?: boolean },\n ): Promise<any>\n removeUser(\n username: string,\n options: { w?: number | string; wtimeout?: number; j?: boolean },\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Rename a collection.\n *\n * @param fromCollection Name of current collection to rename.\n * @param toCollection New name of of the collection.\n * @param callback The results callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#renameCollection\n */\n renameCollection(\n fromCollection: string,\n toCollection: string,\n callback: MongoCallback<Collection<any>>,\n ): void\n\n /**\n * Rename a collection.\n *\n * @param fromCollection Name of current collection to rename.\n * @param toCollection New name of of the collection.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#renameCollection\n */\n renameCollection(\n fromCollection: string,\n toCollection: string,\n options?: { dropTarget?: boolean },\n ): Promise<Collection<any>>\n\n /**\n * Rename a collection.\n *\n * @param fromCollection Name of current collection to rename.\n * @param toCollection New name of of the collection.\n * @param options Optional settings.\n * @param callback The results callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#renameCollection\n */\n renameCollection(\n fromCollection: string,\n toCollection: string,\n options: { dropTarget?: boolean },\n callback: MongoCallback<Collection<any>>,\n ): void\n\n /**\n * Get all the db statistics.\n *\n * @param callback The collection result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#stats\n */\n stats(callback: MongoCallback<any>): void\n\n /**\n * Get all the db statistics.\n *\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#stats\n */\n stats(options?: { scale?: number }): Promise<any>\n\n /**\n * Get all the db statistics.\n *\n * @param options Optional settings.\n * @param callback The collection result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#stats\n */\n stats(options: { scale?: number }, callback: MongoCallback<any>): void\n\n /**\n * Create a new Change Stream, watching for new changes (insertions, updates, replacements, deletions, and invalidations) in this database. Will ignore all changes to system collections.\n * @param pipeline An array of aggregation pipeline stages through which to pass change stream documents. This allows for filtering (using $match) and manipulating the change stream documents.\n * @param options Optional settings.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#watch\n */\n watch(\n pipeline?: Object[],\n options?: ChangeStreamOptions & {\n startAtClusterTime?: Timestamp\n session?: ClientSession\n },\n ): ChangeStream\n}\n\n/**\n * Server.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Server.html\n */\nexport declare class Server extends EventEmitter {\n /**\n *\n * @param host The host for the server, can be either an IP4, IP6 or domain socket style host.\n * @param port The server port if IP4.\n * @param options Optional.\n */\n constructor(host: string, port: number, options?: ServerOptions)\n\n /**\n * All raw connections.\n */\n connections(): Array<any>\n}\n\n/**\n * ReplSet.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/ReplSet.html\n */\nexport declare class ReplSet extends EventEmitter {\n /**\n *\n * @param servers A seedlist of servers participating in the replicaset.\n * @param options Optional.\n */\n constructor(servers: Array<Server>, options?: ReplSetOptions)\n\n /**\n * All raw connections\n */\n connections(): Array<any>\n}\n\n/**\n * Mongos.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Mongos.html\n */\nexport declare class Mongos extends EventEmitter {\n /**\n *\n * @param servers A seedlist of servers participating in the replicaset.\n * @param options Optional.\n */\n constructor(servers: Array<Server>, options?: MongosOptions)\n\n /**\n * All raw connections\n */\n connections(): Array<any>\n}\n\n/**\n * Creates a new Db instance.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#addUser\n */\nexport interface DbAddUserOptions {\n /**\n * The write concern.\n */\n w?: string | number\n\n /**\n * The write concern timeout.\n */\n wtimeout?: number\n\n /**\n * Specify a journal write concern.\n */\n j?: boolean\n\n /**\n * Custom data associated with the user (only Mongodb 2.6 or higher).\n */\n customData?: Object\n\n /**\n * Roles associated with the created user (only Mongodb 2.6 or higher).\n */\n roles?: Object[]\n}\n\n/**\n * Creates a new Db instance.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#createCollection\n */\nexport interface CollectionCreateOptions {\n /**\n * The write concern.\n */\n w?: number | string\n\n /**\n * The write concern timeout.\n */\n wtimeout?: number\n\n /**\n * Specify a journal write concern.\n */\n j?: boolean\n\n /**\n * Return document results as raw BSON buffers.\n */\n raw?: boolean\n\n /**\n * A primary key factory object for generation of custom _id keys.\n */\n pkFactory?: Object\n\n /**\n * The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).\n */\n readPreference?: ReadPreference | string\n\n /**\n * Serialize functions on any object.\n */\n serializeFunctions?: boolean\n\n /**\n * Returns an error if the collection does not exist.\n */\n strict?: boolean\n\n /**\n * Create a capped collection.\n */\n capped?: boolean\n\n /**\n * The size of the capped collection in bytes.\n */\n size?: number\n\n /**\n * The maximum number of documents in the capped collection.\n */\n max?: number\n\n /**\n * Create an index on the _id field of the document, True by default on MongoDB 2.2 or higher off for version < 2.2.\n */\n autoIndexId?: boolean\n}\n\n/**\n * Creates a new Db instance.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#collection\n */\nexport interface DbCollectionOptions {\n /**\n * The write concern.\n */\n w?: number | string\n\n /**\n * The write concern timeout.\n */\n wtimeout?: number\n\n /**\n * Specify a journal write concern.\n */\n j?: boolean\n\n /**\n * Return document results as raw BSON buffers.\n */\n raw?: boolean\n\n /**\n * A primary key factory object for generation of custom _id keys.\n */\n pkFactory?: Object\n\n /**\n * The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).\n */\n readPreference?: ReadPreference | string\n\n /**\n * Serialize functions on any object.\n */\n serializeFunctions?: boolean\n\n /**\n * Returns an error if the collection does not exist.\n */\n strict?: boolean\n\n /**\n * Specify a read concern for the collection. (only MongoDB 3.2 or higher supported).\n */\n readConcern?: ReadConcern\n}\n\n/**\n * Creates an index on the db and collection collection.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#createIndex\n */\nexport interface MongodbIndexOptions {\n /**\n * The write concern.\n */\n w?: number | string\n\n /**\n * The write concern timeout.\n */\n wtimeout?: number\n\n /**\n * Specify a journal write concern.\n */\n j?: boolean\n\n /**\n * Creates an unique index.\n */\n unique?: boolean\n\n /**\n * Creates a sparse index.\n */\n sparse?: boolean\n\n /**\n * Creates the index in the background, yielding whenever possible.\n */\n background?: boolean\n\n /**\n * A unique index cannot be created on a key that has pre-existing duplicate values.\n * If you would like to create the index anyway, keeping the first document\n * the database indexes and deleting all subsequent documents that have duplicate value.\n */\n dropDups?: boolean\n\n /**\n * For geospatial indexes set the lower bound for the co-ordinates.\n */\n min?: number\n\n /**\n * For geospatial indexes set the high bound for the co-ordinates.\n */\n max?: number\n\n /**\n * Specify the format version of the indexes.\n */\n v?: number\n\n /**\n * Allows you to expire data on indexes applied to a data (MongoDB 2.2 or higher).\n */\n expireAfterSeconds?: number\n\n /**\n * Override the autogenerated index name (useful if the resulting name is larger than 128 bytes).\n */\n name?: string\n}\n\n/**\n * Admin.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html\n */\nexport interface Admin {\n /**\n * Add a user to the database.\n *\n * @param username The username.\n * @param password The password.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#addUser\n */\n addUser(\n username: string,\n password: string,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Add a user to the database.\n *\n * @param username The username.\n * @param password The password.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#addUser\n */\n addUser(\n username: string,\n password: string,\n options?: AddUserOptions,\n ): Promise<any>\n\n /**\n * Add a user to the database.\n *\n * @param username The username.\n * @param password The password.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#addUser\n */\n addUser(\n username: string,\n password: string,\n options: AddUserOptions,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Authenticate a user against the server.\n *\n * @param username The username.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#authenticate\n */\n authenticate(username: string, callback: MongoCallback<any>): void\n\n /**\n * Authenticate a user against the server.\n *\n * @param username The username.\n * @param password The password.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#authenticate\n */\n authenticate(username: string, password?: string): Promise<any>\n\n /**\n * Authenticate a user against the server.\n *\n * @param username The username.\n * @param password The password.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#authenticate\n */\n authenticate(\n username: string,\n password: string,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Retrieve the server information for the current instance of the db client\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#buildInfo\n */\n buildInfo(): Promise<any>\n\n /**\n * Retrieve the server information for the current instance of the db client\n *\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#buildInfo\n */\n buildInfo(callback: MongoCallback<any>): void\n\n /**\n * Execute a command.\n *\n * @param command The command hash.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#command\n */\n command(command: Object, callback: MongoCallback<any>): void\n\n /**\n * Execute a command.\n *\n * @param command The command hash.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#command\n */\n command(command: Object, options?: CommandOptions): Promise<any>\n\n /**\n * Execute a command.\n *\n * @param command The command hash.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#command\n */\n command(\n command: Object,\n options: CommandOptions,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * List the available databases.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#listDatabases\n */\n listDatabases(): Promise<any>\n\n /**\n * List the available databases.\n *\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#listDatabases\n */\n listDatabases(callback: MongoCallback<any>): void\n\n /**\n * Logout user from server, fire off on all connections and remove all auth info.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#logout.\n */\n logout(): Promise<any>\n\n /**\n * Logout user from server, fire off on all connections and remove all auth info.\n *\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#logout.\n */\n logout(callback: MongoCallback<any>): void\n\n /**\n * Ping the MongoDB server and retrieve results.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#ping\n */\n ping(): Promise<any>\n\n /**\n * Ping the MongoDB server and retrieve results.\n *\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#ping\n */\n ping(callback: MongoCallback<any>): void\n\n /**\n * Retrive the current profiling information for MongoDB.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#profilingInfo\n */\n profilingInfo(): Promise<any>\n\n /**\n * Retrive the current profiling information for MongoDB.\n *\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#profilingInfo\n */\n profilingInfo(callback: MongoCallback<any>): void\n\n /**\n * Retrieve the current profiling Level for MongoDB.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#profilingLevel\n */\n profilingLevel(): Promise<any>\n\n /**\n * Retrieve the current profiling Level for MongoDB.\n *\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#profilingLevel\n */\n profilingLevel(callback: MongoCallback<any>): void\n\n /**\n * Remove a user from a database.\n *\n * @param username The username.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#removeUser\n */\n removeUser(username: string, callback: MongoCallback<any>): void\n\n /**\n * Remove a user from a database.\n *\n * @param username The username.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#removeUser\n */\n removeUser(username: string, options?: FSyncOptions): Promise<any>\n\n /**\n * Remove a user from a database.\n *\n * @param username The username.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#removeUser\n */\n removeUser(\n username: string,\n options: FSyncOptions,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Get ReplicaSet status.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#replSetGetStatus\n */\n replSetGetStatus(): Promise<any>\n\n /**\n * Get ReplicaSet status.\n *\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#replSetGetStatus\n */\n replSetGetStatus(callback: MongoCallback<any>): void\n\n /**\n * Retrieve the server information for the current\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#serverInfo\n */\n serverInfo(): Promise<any>\n\n /**\n * instance of the db client\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#serverInfo\n * @param callback The command result callback.\n */\n serverInfo(callback: MongoCallback<any>): void\n\n /**\n * Retrieve this db's server status.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#serverStatus\n */\n serverStatus(): Promise<any>\n\n /**\n * Retrieve this db's server status.\n *\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#serverStatus\n */\n serverStatus(callback: MongoCallback<any>): void\n\n /**\n * Set the current profiling level of MongoDB.\n *\n * @param level The new profiling level (off, slow_only, all).\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#setProfilingLevel\n */\n setProfilingLevel(level: string): Promise<any>\n\n /**\n * Set the current profiling level of MongoDB.\n *\n * @param level The new profiling level (off, slow_only, all).\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#setProfilingLevel\n */\n setProfilingLevel(level: string, callback: MongoCallback<any>): void\n\n /**\n * Validate an existing collection\n *\n * @param collectionNme The name of the collection to validate.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#validateCollection\n */\n validateCollection(\n collectionNme: string,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Validate an existing collection\n *\n * @param collectionNme The name of the collection to validate.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#validateCollection\n */\n validateCollection(collectionNme: string, options?: Object): Promise<any>\n\n /**\n * Validate an existing collection\n *\n * @param collectionNme The name of the collection to validate.\n * @param options Optional settings.\n * @param callback The command result callback\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#validateCollection\n */\n validateCollection(\n collectionNme: string,\n options: Object,\n callback: MongoCallback<any>,\n ): void\n}\n\n/**\n * Add a user to the database.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#addUser\n */\nexport interface AddUserOptions {\n /**\n * The write concern.\n */\n w?: number | string\n\n /**\n * The write concern timeout.\n */\n wtimeout?: number\n\n /**\n * Specify a journal write concern.\n */\n j?: boolean\n\n /**\n * Specify a file sync write concern.\n */\n fsync: boolean\n\n /**\n * Custom data associated with the user (only Mongodb 2.6 or higher).\n */\n customData?: Object\n\n /**\n * Roles associated with the created user (only Mongodb 2.6 or higher).\n */\n roles?: Object[]\n}\nexport interface ListIndexesOptions {\n /**\n * The batchSize for the returned command cursor or if pre 2.8 the systems batch collection.\n */\n batchSize?: number\n\n /**\n * The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED,\n * ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).\n */\n readPreference?: ReadPreference | string\n}\n\nexport interface GroupOptions {\n /**\n * The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED,\n * ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).\n */\n readPreference?: ReadPreference | string\n}\n\n/**\n * Remove a user from a database.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#removeUser\n */\nexport interface FSyncOptions {\n /**\n * The write concern.\n */\n w?: number | string\n\n /**\n * The write concern timeout.\n */\n wtimeout?: number\n\n /**\n * Specify a journal write concern.\n */\n j?: boolean\n\n /**\n * Specify a file sync write concern.\n */\n fsync?: boolean\n}\n\nexport interface FindOneAndDeleteOptions {\n /**\n * Limits the fields to return for all matching documents.\n */\n projection?: Object\n\n /**\n * Determines which document the operation modifies if the query selects multiple documents.\n */\n sort?: Object\n\n /**\n * The maximum amount of time to allow the query to run.\n */\n maxTimeMS?: number\n}\n\n/**\n * Create a new ObjectID instance.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/ObjectID.html\n */\nexport declare class ObjectID {\n constructor(s?: string | number)\n\n /**\n * The generation time of this ObjectId instance.\n */\n generationTime: number\n\n /**\n * Creates an ObjectID from a hex string representation of an ObjectID.\n */\n static createFromHexString(hexString: string): ObjectID\n\n /**\n * Creates an ObjectID from a second based number, with the rest of the ObjectID zeroed out. Used for comparisons or sorting the ObjectID.\n */\n static createFromTime(time: number): ObjectID\n\n /**\n * Checks if a value is a valid bson ObjectId.\n */\n static isValid(id: any): boolean\n\n /**\n * Compares the equality of this ObjectID with otherID.\n */\n equals(otherID: ObjectID): boolean\n\n /**\n * Generate a 12 byte id buffer used in ObjectID's.\n */\n generate(time?: number): string\n\n /**\n * Returns the generation date (accurate up to the second) that this ID was generated.\n *\n */\n getTimestamp(): Date\n\n /**\n * Return the ObjectID id as a 24 byte hex string representation.\n */\n toHexString(): string\n\n /**\n * Get the timestamp and validate correctness.\n */\n toString(): string\n}\n\n/**\n * A class representation of the BSON Binary type.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Binary.html\n */\nexport declare class Binary {\n /**\n * @param buffer A buffer object containing the binary data.\n * @param subType The option binary type.\n */\n constructor(buffer: Buffer, subType?: number)\n\n /**\n * Byte Array BSON type.\n */\n static SUBTYPE_BYTE_ARRAY: number\n\n /**\n * Default BSON type.\n */\n static SUBTYPE_DEFAULT: number\n\n /**\n * Function BSON type.\n */\n static SUBTYPE_FUNCTION: number\n\n /**\n * MD5 BSON type.\n */\n static SUBTYPE_MD5: number\n\n /**\n * User BSON type.\n */\n static SUBTYPE_USER_DEFINED: number\n\n /**\n * UUID BSON type.\n */\n static SUBTYPE_UUID: number\n\n /**\n * OLD UUID BSON type\n */\n static SUBTYPE_UUID_OLD: number\n\n /**\n * The length of the binary.\n */\n length(): number\n\n /**\n * Updates this binary with byte_value.\n *\n * @param byte_value A single byte we wish to write.\n */\n put(byte_value: number | string): void\n\n /**\n * Reads length bytes starting at position.\n *\n * @param position Read from the given position in the Binary.\n * @param length The number of bytes to read.\n */\n read(position: number, length: number): Buffer\n\n /**\n * Returns the value of this binary as a string.\n */\n value(): string\n\n /**\n * Writes a buffer or string to the binary\n *\n * @param buffer A string or buffer to be written to the Binary BSON object.\n * @param offset Specify the binary of where to write the content.\n */\n write(buffer: Buffer | string, offset: number): void\n}\n/**\n * A class representation of the BSON Double type.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Double.html\n */\nexport declare class Double {\n /**\n * @param value The number we want to represent as a double.\n */\n constructor(value: number)\n\n /**\n * Access the number value.\n */\n valueOf(): number\n}\n\n/**\n * Long\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Long.html\n */\nexport declare class Long {\n /**\n * @param low The low (signed) 32 bits of the Long.\n * @param high The high (signed) 32 bits of the Long.\n */\n constructor(low: number, high: number)\n\n static MAX_VALUE: Long\n static MIN_VALUE: Long\n static NEG_ONE: Long\n static ONE: Long\n static ZERO: Long\n\n /**\n * Returns a Long representing the 64-bit integer that comes by concatenating the given high and low bits.\n * Each is assumed to use 32 bits.\n *\n * @param lowBits The low 32-bits.\n * @param highBits The high 32-bits.\n */\n static fromBits(lowBits: number, highBits: number): Long\n\n /**\n * Returns a Long representing the given (32-bit) integer value.\n *\n * @param value The 32-bit integer in question.\n */\n static fromInt(value: number): Long\n\n /**\n * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.\n *\n * @param value The number in question.\n */\n static fromNumber(value: number): Long\n\n /**\n * Returns a Long representation of the given string, written using the given radix.\n *\n * @param str The textual representation of the Long.\n * @param radix The radix in which the text is written.\n */\n static fromString(str: string, radix?: number): Long\n\n /**\n * Returns the sum of this and the given Long.\n *\n * @param other Long to add to this one.\n */\n add(other: Long): Long\n\n /**\n * Returns the bitwise-AND of this Long and the given one.\n *\n * @param other The Long with which to AND.\n */\n and(other: Long): Long\n\n /**\n * Compares this Long with the given one.\n *\n * @param other Long to compare against.\n */\n compare(other: Long): number\n\n /**\n * Returns this Long divided by the given one.\n *\n * @param other Long by which to divide.\n */\n div(other: Long): Long\n\n /**\n * Return whether this Long equals the other.\n *\n * @param other Long to compare against.\n */\n equals(other: Long): boolean\n\n /**\n * Return the high 32-bits value.\n */\n getHighBits(): number\n\n /**\n * Return the low 32-bits value.\n */\n getLowBits(): number\n\n /**\n * Return the low unsigned 32-bits value.\n */\n getLowBitsUnsigned(): number\n\n /**\n * Returns the number of bits needed to represent the absolute value of this Long.\n */\n getNumBitsAbs(): number\n\n /**\n * Return whether this Long is greater than the other.\n *\n * @param other Long to compare against.\n */\n greaterThan(other: Long): number\n\n /**\n * Return whether this Long is greater than or equal to the other.\n *\n * @param other Long to compare against.\n */\n greaterThanOrEqual(other: Long): number\n\n /**\n * Return whether this value is negative.\n */\n isNegative(): boolean\n\n /**\n * Return whether this value is odd.\n */\n isOdd(): boolean\n\n /**\n * Return whether this value is zero.\n */\n isZero(): boolean\n\n /**\n * Return whether this Long is less than the other.\n *\n * @param other Long to compare against.\n */\n lessThan(other: Long): boolean\n\n /**\n * Return whether this Long is less than or equal to the other.\n *\n * @param other Long to compare against.\n */\n lessThanOrEqual(other: Long): boolean\n\n /**\n * Returns this Long modulo the given one.\n *\n * @param other Long by which to mod.\n */\n modulo(other: Long): Long\n\n /**\n * Returns the product of this and the given Long.\n *\n * @param other Long to multiply with this.\n */\n multiply(other: Long): Long\n\n /**\n * The negation of this value.\n */\n negate(): Long\n\n /**\n * The bitwise-NOT of this value.\n */\n not(): Long\n\n /**\n * Return whether this Long does not equal the other.\n *\n * @param other Long to compare against.\n */\n notEquals(other: Long): boolean\n\n /**\n * Returns the bitwise-OR of this Long and the given one.\n *\n * @param other The Long with which to OR.\n */\n or(other: Long): Long\n\n /**\n * Returns this Long with bits shifted to the left by the given amount.\n *\n * @param other The number of bits by which to shift.\n */\n shiftLeft(other: number): Long\n\n /**\n * Returns this Long with bits shifted to the right by the given amount.\n *\n * @param other The number of bits by which to shift.\n */\n shiftRight(other: number): Long\n\n /**\n * Returns this Long with bits shifted to the right by the given amount, with the new top bits matching the current sign bit.\n *\n * @param other The number of bits by which to shift.\n */\n shiftRightUnsigned(other: number): Long\n\n /**\n * Returns the difference of this and the given Long.\n *\n * @param other Long to subtract from this.\n */\n subtract(other: Long): Long\n\n /**\n * Return the int value.\n */\n toInt(): number\n\n /**\n * Return the JSON value.\n */\n toJSON(): string\n\n /**\n * Return the Number value.\n */\n toNumber(): number\n\n /**\n * Return the String value.\n *\n * @param opt_radix The radix in which the text should be written.\n */\n toString(opt_radix?: number): string\n\n /**\n * Returns the bitwise-XOR of this Long and the given one.\n *\n * @param other The Long with which to XOR.\n */\n xor(other: Long): Long\n}\n\n/**\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/MaxKey.html\n */\nexport declare class MaxKey {}\n\n/**\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/MinKey.html\n */\nexport declare class MinKey {}\n\n/**\n * Timestamp.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Timestamp.html\n */\nexport declare class Timestamp {\n /**\n * @param low The low (signed) 32 bits of the Timestamp.\n * @param high The high (signed) 32 bits of the Timestamp.\n */\n constructor(low: number, high: number)\n\n static MAX_VALUE: Timestamp\n static MIN_VALUE: Timestamp\n static NEG_ONE: Timestamp\n static ONE: Timestamp\n static ZERO: Timestamp\n\n /**\n * Returns a Timestamp representing the 64-bit integer that comes by concatenating the\n * given high and low bits. Each is assumed to use 32 bits..\n *\n * @param lowBits The low 32-bits.\n * @param highBits The high 32-bits.\n */\n static fromBits(lowBits: number, highBits: number): Timestamp\n\n /**\n * Returns a Timestamp representing the given (32-bit) integer value.\n *\n * @param value The 32-bit integer in question.\n */\n static fromInt(value: number): Timestamp\n\n /**\n * Returns a Timestamp representing the given value, provided that it is a finite number. Otherwise, zero is returned.\n *\n * @param value The number in question.\n */\n static fromNumber(value: number): Timestamp\n\n /**\n * Returns a Timestamp representation of the given string, written using the given radix.\n *\n * @param str The textual representation of the Timestamp.\n * @param radix The radix in which the text is written.\n */\n static fromString(str: string, radix?: number): Timestamp\n\n /**\n * Returns the sum of this and the given Timestamp.\n *\n * @param other Timestamp to add to this one.\n */\n add(other: Timestamp): Timestamp\n\n /**\n * Returns the bitwise-AND of this Timestamp and the given one.\n *\n * @param other Timestamp to add to this one.\n */\n and(other: Timestamp): Timestamp\n\n /**\n * Compares this Timestamp with the given one.\n *\n * @param other Timestamp to compare against.\n */\n compare(other: Timestamp): number\n\n /**\n * Returns this Timestamp divided by the given one.\n *\n * @param other Timestamp by which to divide.\n */\n div(other: Timestamp): Timestamp\n\n /**\n * Return whether this Timestamp equals the other\n *\n * @param other\n */\n equals(other: Timestamp): boolean\n\n /**\n * Return the high 32-bits value.\n */\n getHighBits(): number\n\n /**\n * Return the low 32-bits value.\n */\n getLowBits(): number\n\n /**\n * Return the low unsigned 32-bits value.\n */\n getLowBitsUnsigned(): number\n\n /**\n * Returns the number of bits needed to represent the absolute value of this Timestamp.\n */\n getNumBitsAbs(): number\n\n /**\n * Return whether this Timestamp is greater than the other.\n *\n * @param other Timestamp to compare against.\n */\n greaterThan(other: Timestamp): number\n\n /**\n * Return whether this Timestamp is greater than or equal to the other.\n *\n * @param other Timestamp to compare against.\n */\n greaterThanOrEqual(other: Timestamp): number\n\n /**\n * Return whether this value is negative.\n */\n isNegative(): boolean\n\n /**\n * IsOdd.\n * Return whether this value is odd.\n */\n isOdd(): boolean\n\n /**\n * Return whether this value is zero.\n */\n isZero(): boolean\n\n /**\n * Return whether this Timestamp is less than the other.\n *\n * @param other Timestamp to compare against.\n */\n lessThan(other: Timestamp): boolean\n\n /**\n * Return whether this Timestamp is less than or equal to the other.\n *\n * @param other Timestamp to compare against.\n */\n lessThanOrEqual(other: Timestamp): boolean\n\n /**\n * Returns this Timestamp modulo the given one.\n *\n * @param other Timestamp by which to mod.\n */\n modulo(other: Timestamp): Timestamp\n\n /**\n * Returns the product of this and the given Timestamp.\n *\n * @param other Timestamp to multiply with this.\n */\n multiply(other: Timestamp): Timestamp\n\n /**\n * The negation of this value.\n */\n negate(): Timestamp\n\n /**\n * The bitwise-NOT of this value.\n */\n not(): Timestamp\n\n /**\n * Return whether this Timestamp does not equal the other.\n *\n * @param other Timestamp to compare against.\n */\n notEquals(other: Timestamp): boolean\n\n /**\n * Returns the bitwise-OR of this Timestamp and the given one.\n *\n * @param other The Timestamp with which to OR.\n */\n or(other: Timestamp): Timestamp\n\n /**\n * Returns this Timestamp with bits shifted to the left by the given amount.\n *\n * @param other The number of bits by which to shift.\n */\n shiftLeft(other: number): Timestamp\n\n /**\n * Returns this Timestamp with bits shifted to the right by the given amount.\n *\n * @param other The number of bits by which to shift.\n */\n shiftRight(other: number): Timestamp\n\n /**\n * Returns this Timestamp with bits shifted to the right by the given amount, with the new top bits matching the current sign bit.\n *\n * @param other\n */\n shiftRightUnsigned(other: number): Timestamp\n\n /**\n * Returns the difference of this and the given Timestamp.\n *\n * @param other Timestamp to subtract from this.\n */\n subtract(other: Timestamp): Timestamp\n\n /**\n * Return the int value.\n */\n toInt(): number\n\n /**\n * Return the JSON value.\n */\n toJSON(): string\n\n /**\n * Return the Number value.\n */\n toNumber(): number\n\n /**\n * Return the String value.\n *\n * @param radix The radix in which the text should be written.\n */\n toString(radix?: number): string\n\n /**\n * Returns the bitwise-XOR of this Timestamp and the given one.\n *\n * @param other The Timestamp with which to XOR.\n */\n xor(other: Timestamp): Timestamp\n}\n\nexport interface CollectionDeleteOneOptions {\n /**\n * The write concern.\n */\n w?: number | string\n\n /**\n * The write concern timeout.\n */\n wtimmeout?: number\n\n /**\n * Specify a journal write concern.\n */\n j?: boolean\n\n /**\n * Allow driver to bypass schema validation in MongoDB 3.2 or higher.\n */\n bypassDocumentValidation?: boolean\n}\n\nexport interface CollectionDistinctOptions {\n /**\n * The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED,\n * ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).\n */\n readPreference?: ReadPreference | string\n}\n\n/**\n * Create a new ObjectID instance.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html\n */\nexport interface Collection<T> {\n /**\n * Get the collection name.\n */\n collectionName: string\n\n /**\n * Get the full collection namespace.\n */\n namespace: string\n\n /**\n * The current write concern values.\n */\n writeConcern: WriteConcern\n\n /**\n * The current read concern values.\n */\n readConcern: ReadConcern\n\n /**\n * Get current index hint for collection.\n */\n hint: any\n\n /**\n * Execute an aggregation framework pipeline against the collection, needs MongoDB >= 2.2\n *\n * @param pipeline Array containing all the aggregation framework commands for the execution.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#aggregate\n */\n aggregate(\n pipeline: Object[],\n callback: MongoCallback<any>,\n ): AggregationCursor<any>\n\n /**\n * Execute an aggregation framework pipeline against the collection, needs MongoDB >= 2.2\n *\n * @param pipeline Array containing all the aggregation framework commands for the execution.\n * @param options Optional.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#aggregate\n */\n aggregate(\n pipeline: Object[],\n options?: CollectionAggregationOptions,\n callback?: MongoCallback<any>,\n ): AggregationCursor<any>\n\n /**\n * Execute an aggregation framework pipeline against the collection, needs MongoDB >= 2.2\n *\n * @param pipeline Array containing all the aggregation framework commands for the execution.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#aggregate\n */\n aggregate<T>(\n pipeline: Object[],\n callback: MongoCallback<any>,\n ): AggregationCursor<T>\n\n /**\n * Execute an aggregation framework pipeline against the collection, needs MongoDB >= 2.2\n *\n * @param pipeline Array containing all the aggregation framework commands for the execution.\n * @param options Optional.\n * @param callback Optional\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#aggregate\n */\n aggregate<T>(\n pipeline: Object[],\n options?: CollectionAggregationOptions,\n callback?: MongoCallback<any>,\n ): AggregationCursor<T>\n\n /**\n * BulkWrite.\n *\n * @param operations Bulk operations to perform.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#bulkWrite\n */\n bulkWrite(\n operations: Object[],\n callback: MongoCallback<BulkWriteOpResultObject>,\n ): void\n\n /**\n * BulkWrite.\n *\n * @param operations Bulk operations to perform.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#bulkWrite\n */\n bulkWrite(\n operations: Object[],\n options?: CollectionBulkWriteOptions,\n ): Promise<BulkWriteOpResultObject>\n\n /**\n * BulkWrite.\n *\n * @param operations Bulk operations to perform.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#bulkWrite\n */\n bulkWrite(\n operations: Object[],\n options: CollectionBulkWriteOptions,\n callback: MongoCallback<BulkWriteOpResultObject>,\n ): void\n\n /**\n * Count number of matching documents in the db to a query.\n *\n * @param query The query for the count.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#count\n */\n count(query: FilterQuery<T>, callback: MongoCallback<number>): void\n\n /**\n * Count number of matching documents in the db to a query.\n *\n * @param query The query for the count.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#count\n */\n count(\n query: FilterQuery<T>,\n options?: MongoCountPreferences,\n ): Promise<number>\n\n /**\n * Count number of matching documents in the db to a query.\n *\n * @param query The query for the count=\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#count\n */\n count(\n query: FilterQuery<T>,\n options: MongoCountPreferences,\n callback: MongoCallback<number>,\n ): void\n\n /**\n * Count number of matching documents in the db to a query.\n *\n * @param query The query for the countDocuments.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#countDocumentst\n */\n countDocuments(query: FilterQuery<T>, callback: MongoCallback<number>): void\n\n /**\n * Count number of matching documents in the db to a query.\n *\n * @param query The query for the count.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#countDocuments\n */\n countDocuments(\n query: FilterQuery<T>,\n options?: MongoCountPreferences,\n ): Promise<number>\n\n /**\n * Count number of matching documents in the db to a query.\n *\n * @param query The query for the count=\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#countDocuments\n */\n countDocuments(\n query: FilterQuery<T>,\n options: MongoCountPreferences,\n callback: MongoCallback<number>,\n ): void\n\n /**\n * Creates an index on the db and collection collection.\n *\n * @param fieldOrSpec Defines the index.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#createIndex\n */\n createIndex(\n fieldOrSpec: string | any,\n callback: MongoCallback<string>,\n ): void\n\n /**\n * Creates an index on the db and collection collection.\n *\n * @param fieldOrSpec Defines the index.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#createIndex\n */\n createIndex(\n fieldOrSpec: string | any,\n options?: MongodbIndexOptions,\n ): Promise<string>\n\n /**\n * Creates an index on the db and collection collection.\n *\n * @param fieldOrSpec Defines the index.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#createIndex\n */\n createIndex(\n fieldOrSpec: string | any,\n options: MongodbIndexOptions,\n callback: MongoCallback<string>,\n ): void\n\n /**\n * CreateIndexes.\n *\n * @param indexSpecs An array of index specifications to be created.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#createIndexes and http://docs.mongodb.org/manual/reference/command/createIndexes/\n */\n createIndexes(indexSpecs: Object[]): Promise<any>\n\n /**\n * CreateIndexes.\n *\n * @param indexSpecs An array of index specifications to be created.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#createIndexes and http://docs.mongodb.org/manual/reference/command/createIndexes/\n */\n createIndexes(indexSpecs: Object[], callback: MongoCallback<any>): void\n\n /**\n * Delete multiple documents on MongoDB.\n *\n * @param filter The Filter used to select the documents to remove.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#deleteMany\n */\n deleteMany(\n filter: FilterQuery<T>,\n callback: MongoCallback<DeleteWriteOpResultObject>,\n ): void\n\n /**\n * Delete multiple documents on MongoDB.\n *\n * @param filter The Filter used to select the documents to remove.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#deleteMany\n */\n deleteMany(\n filter: FilterQuery<T>,\n options?: CollectionOptions,\n ): Promise<DeleteWriteOpResultObject>\n\n /**\n * Delete multiple documents on MongoDB.\n *\n * @param filter The Filter used to select the documents to remove.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#deleteMany\n */\n deleteMany(\n filter: FilterQuery<T>,\n options: CollectionOptions,\n callback: MongoCallback<DeleteWriteOpResultObject>,\n ): void\n\n /**\n * Delete a document on MongoDB.\n *\n * @param filter The Filter used to select the document to remove.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#deleteOne\n */\n deleteOne(\n filter: FilterQuery<T>,\n callback: MongoCallback<DeleteWriteOpResultObject>,\n ): void\n\n /**\n * Delete a document on MongoDB.\n *\n * @param filter The Filter used to select the document to remove.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#deleteOne\n */\n deleteOne(\n filter: FilterQuery<T>,\n options?: CollectionDeleteOneOptions,\n ): Promise<DeleteWriteOpResultObject>\n\n /**\n * Delete a document on MongoDB.\n *\n * @param filter The Filter used to select the document to remove.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#deleteOne\n */\n deleteOne(\n filter: FilterQuery<T>,\n options: CollectionDeleteOneOptions,\n callback: MongoCallback<DeleteWriteOpResultObject>,\n ): void\n\n /**\n * The distinct command returns returns a list of distinct values for the given key across a collection.\n *\n * @param key Field of the document to find distinct values for.\n * @param query The query for filtering the set of documents to which we apply the distinct filter.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#distinct\n */\n distinct(\n key: string,\n query: FilterQuery<T>,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * The distinct command returns returns a list of distinct values for the given key across a collection.\n *\n * @param key Field of the document to find distinct values for.\n * @param query The query for filtering the set of documents to which we apply the distinct filter.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#distinct\n */\n distinct(\n key: string,\n query: FilterQuery<T>,\n options?: CollectionDistinctOptions,\n ): Promise<any>\n\n /**\n * The distinct command returns returns a list of distinct values for the given key across a collection.\n *\n * @param key Field of the document to find distinct values for.\n * @param query The query for filtering the set of documents to which we apply the distinct filter.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#distinct\n */\n distinct(\n key: string,\n query: FilterQuery<T>,\n options: CollectionDistinctOptions,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Drop the collection from the database, removing it permanently. New accesses will create a new collection.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#drop\n */\n drop(): Promise<any>\n\n /**\n * Drop the collection from the database, removing it permanently. New accesses will create a new collection.\n *\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#drop\n */\n drop(callback: MongoCallback<any>): void\n\n /**\n * Drops an index from this collection.\n *\n * @param indexName Name of the index to drop.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#dropIndex\n */\n dropIndex(indexName: string, callback: MongoCallback<any>): void\n\n /**\n * Drops an index from this collection.\n *\n * @param indexName Name of the index to drop.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#dropIndex\n */\n dropIndex(indexName: string, options?: CollectionOptions): Promise<any>\n\n /**\n * Drops an index from this collection.\n *\n * @param indexName Name of the index to drop.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#dropIndex\n */\n dropIndex(\n indexName: string,\n options: CollectionOptions,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Drops all indexes from this collection.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#dropIndexes\n */\n dropIndexes(): Promise<any>\n\n /**\n * Drops all indexes from this collection.\n *\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#dropIndexes\n */\n dropIndexes(callback?: MongoCallback<any>): void\n\n /**\n * Creates a cursor for a query that can be used to iterate over results from MongoDB.\n *\n * @param query The cursor query object.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#find\n */\n find(query?: Object): Cursor<any>\n\n /**\n * Creates a cursor for a query that can be used to iterate over results from MongoDB.\n *\n * @param query The cursor query object.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#find\n */\n find<T>(query?: FilterQuery<T>): Cursor<T>\n\n /** @deprecated */\n find(\n query: FilterQuery<T>,\n fields?: Object,\n skip?: number,\n limit?: number,\n timeout?: number,\n ): Cursor<any>\n\n /**\n * Fetches the first document that matches the query.\n *\n * @param query Query for find Operation.\n * @param callback The command result callback.\n * @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#findOne\n */\n findOne(query: FilterQuery<T>, callback: MongoCallback<any>): void\n\n /**\n * Fetches the first document that matches the query.\n *\n * @param query Query for find Operation.\n * @param options Optional.\n * @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#findOne\n */\n findOne(\n query: FilterQuery<T>,\n options?: MongodbFindOneOptions,\n ): Promise<any>\n\n /**\n * Fetches the first document that matches the query.\n *\n * @param query Query for find Operation.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#findOne\n */\n findOne(\n query: FilterQuery<T>,\n options: MongodbFindOneOptions,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Find a document and delete it in one atomic operation, requires a write lock for the duration of the operation.\n *\n * @param filter Document selection filter.\n * @param callback The collection result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#findOneAndDelete\n */\n findOneAndDelete(\n filter: FilterQuery<T>,\n callback: MongoCallback<FindAndModifyWriteOpResultObject>,\n ): void\n\n /**\n * Find a document and delete it in one atomic operation, requires a write lock for the duration of the operation.\n *\n * @param filter Document selection filter.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#findOneAndDelete\n */\n findOneAndDelete(\n filter: FilterQuery<T>,\n options?: FindOneAndDeleteOptions,\n ): Promise<FindAndModifyWriteOpResultObject>\n\n /**\n * Find a document and delete it in one atomic operation, requires a write lock for the duration of the operation.\n *\n * @param filter Document selection filter.\n * @param options Optional settings.\n * @param callback The collection result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#findOneAndDelete\n */\n findOneAndDelete(\n filter: FilterQuery<T>,\n options: FindOneAndDeleteOptions,\n callback: MongoCallback<FindAndModifyWriteOpResultObject>,\n ): void\n\n /**\n * Find a document and replace it in one atomic operation, requires a write lock for the duration of the operation.\n *\n * @param filter Document selection filter.\n * @param replacement Document replacing the matching document.\n * @param callback The collection result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#findOneAndReplace\n */\n findOneAndReplace(\n filter: FilterQuery<T>,\n replacement: Object,\n callback: MongoCallback<FindAndModifyWriteOpResultObject>,\n ): void\n\n /**\n * Find a document and replace it in one atomic operation, requires a write lock for the duration of the operation.\n *\n * @param filter Document selection filter.\n * @param replacement Document replacing the matching document.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#findOneAndReplace\n */\n findOneAndReplace(\n filter: FilterQuery<T>,\n replacement: Object,\n options?: FindOneAndReplaceOption,\n ): Promise<FindAndModifyWriteOpResultObject>\n\n /**\n * Find a document and replace it in one atomic operation, requires a write lock for the duration of the operation.\n *\n * @param filter Document selection filter.\n * @param replacement Document replacing the matching document.\n * @param options Optional settings.\n * @param callback The collection result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#findOneAndReplace\n */\n findOneAndReplace(\n filter: FilterQuery<T>,\n replacement: Object,\n options: FindOneAndReplaceOption,\n callback: MongoCallback<FindAndModifyWriteOpResultObject>,\n ): void\n\n /**\n * Find a document and update it in one atomic operation, requires a write lock for the duration of the operation.\n *\n * @param filter Document selection filter.\n * @param update Update operations to be performed on the document.\n * @param callback The collection result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#findOneAndUpdate\n */\n findOneAndUpdate(\n filter: FilterQuery<T>,\n update: UpdateQuery<T>,\n callback: MongoCallback<FindAndModifyWriteOpResultObject>,\n ): void\n\n /**\n * Find a document and update it in one atomic operation, requires a write lock for the duration of the operation.\n *\n * @param filter Document selection filter.\n * @param update Update operations to be performed on the document.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#findOneAndUpdate\n */\n findOneAndUpdate(\n filter: FilterQuery<T>,\n update: UpdateQuery<T>,\n options?: FindOneAndReplaceOption,\n ): Promise<FindAndModifyWriteOpResultObject>\n\n /**\n * Find a document and update it in one atomic operation, requires a write lock for the duration of the operation.\n *\n * @param filter Document selection filter.\n * @param update Update operations to be performed on the document.\n * @param options Optional settings.\n * @param callback The collection result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#findOneAndUpdate\n */\n findOneAndUpdate(\n filter: FilterQuery<T>,\n update: UpdateQuery<T>,\n options: FindOneAndReplaceOption,\n callback: MongoCallback<FindAndModifyWriteOpResultObject>,\n ): void\n\n /**\n * Execute a geo search using a geo haystack index on a collection.\n *\n * @param x Point to search on the x axis, ensure the indexes are ordered in the same order.\n * @param y Point to search on the y axis, ensure the indexes are ordered in the same order.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#geoHaystackSearch\n */\n geoHaystackSearch(x: number, y: number, callback: MongoCallback<any>): void\n\n /**\n * Execute a geo search using a geo haystack index on a collection.\n *\n * @param x Point to search on the x axis, ensure the indexes are ordered in the same order.\n * @param y Point to search on the y axis, ensure the indexes are ordered in the same order.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#geoHaystackSearch\n */\n geoHaystackSearch(\n x: number,\n y: number,\n options?: GeoHaystackSearchOptions,\n ): Promise<any>\n\n /**\n * Execute a geo search using a geo haystack index on a collection.\n *\n * @param x Point to search on the x axis, ensure the indexes are ordered in the same order.\n * @param y Point to search on the y axis, ensure the indexes are ordered in the same order.\n * @param options Optional settings\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#geoHaystackSearch\n */\n geoHaystackSearch(\n x: number,\n y: number,\n options: GeoHaystackSearchOptions,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Execute the geoNear command to search for items in the collection.\n *\n * @param x Point to search on the x axis, ensure the indexes are ordered in the same order.\n * @param y Point to search on the y axis, ensure the indexes are ordered in the same order.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#geoNear\n */\n geoNear(x: number, y: number, callback: MongoCallback<any>): void\n\n /**\n * Execute the geoNear command to search for items in the collection.\n *\n * @param x Point to search on the x axis, ensure the indexes are ordered in the same order.\n * @param y Point to search on the y axis, ensure the indexes are ordered in the same order.\n * @param options Optionals.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#geoNear\n */\n geoNear(x: number, y: number, options?: GeoNearOptions): Promise<any>\n\n /**\n * Execute the geoNear command to search for items in the collection.\n *\n * @param x Point to search on the x axis, ensure the indexes are ordered in the same order.\n * @param y Point to search on the y axis, ensure the indexes are ordered in the same order.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#geoNear\n */\n geoNear(\n x: number,\n y: number,\n options: GeoNearOptions,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Run a group command across a collection.\n *\n * @param keys An object, array or function expressing the keys to group by.\n * @param condition An optional condition that must be true for a row to be considered.\n * @param initial Initial value of the aggregation counter object.\n * @param reduce The reduce function aggregates (reduces) the objects iterated.\n * @param finalize An optional function to be run on each item in the result set just before the item is returned.\n * @param command Specify if you wish to run using the internal group command or using eval, default is true.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#group\n */\n group(\n keys: Object | Array<any> | Function | Code,\n condition: Object,\n initial: Object,\n reduce: Function | Code,\n finalize: Function | Code,\n command: boolean,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Run a group command across a collection.\n *\n * @param keys An object, array or function expressing the keys to group by.\n * @param condition An optional condition that must be true for a row to be considered.\n * @param initial Initial value of the aggregation counter object.\n * @param reduce The reduce function aggregates (reduces) the objects iterated.\n * @param finalize An optional function to be run on each item in the result set just before the item is returned.\n * @param command Specify if you wish to run using the internal group command or using eval, default is true.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#group\n */\n group(\n keys: Object | Array<any> | Function | Code,\n condition: Object,\n initial: Object,\n reduce: Function | Code,\n finalize: Function | Code,\n command: boolean,\n options?: GroupOptions,\n ): Promise<any>\n\n /**\n * Run a group command across a collection.\n *\n * @param keys An object, array or function expressing the keys to group by.\n * @param condition An optional condition that must be true for a row to be considered.\n * @param initial Initial value of the aggregation counter object.\n * @param reduce The reduce function aggregates (reduces) the objects iterated.\n * @param finalize An optional function to be run on each item in the result set just before the item is returned.\n * @param command Specify if you wish to run using the internal group command or using eval, default is true.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#group\n */\n group(\n keys: Object | Array<any> | Function | Code,\n condition: Object,\n initial: Object,\n reduce: Function | Code,\n finalize: Function | Code,\n command: boolean,\n options: GroupOptions,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Retrieve all the indexes on the collection.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#indexes\n */\n indexes(): Promise<any>\n\n /**\n * Retrieve all the indexes on the collection.\n *\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#indexes\n */\n indexes(callback: MongoCallback<any>): void\n\n /**\n * Checks if one or more indexes exist on the collection, fails on first non-existing index.\n *\n * @param indexes One or more index names to check.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#indexExists\n */\n indexExists(indexes: string | string[]): Promise<boolean>\n\n /**\n * Checks if one or more indexes exist on the collection, fails on first non-existing index.\n *\n * @param indexes One or more index names to check.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#indexExists\n */\n indexExists(\n indexes: string | string[],\n callback: MongoCallback<boolean>,\n ): void\n\n /**\n * Retrieves this collections index info.\n *\n * @param callback The command result callback\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#indexInformation\n */\n indexInformation(callback: MongoCallback<any>): void\n\n /**\n * Retrieves this collections index info.\n *\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#indexInformation\n */\n indexInformation(options?: { full: boolean }): Promise<any>\n\n /**\n * Retrieves this collections index info.\n *\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#indexInformation\n */\n indexInformation(\n options: { full: boolean },\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Initiate an In order bulk write operation, operations will be serially executed in the order they are added,\n * creating a new operation for each switch in types.\n *\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#initializeOrderedBulkOp\n */\n initializeOrderedBulkOp(options?: CollectionOptions): OrderedBulkOperation\n\n /**\n * Initiate a Out of order batch write operation. All operations will be buffered into insert/update/remove commands executed out of order.\n *\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#initializeUnorderedBulkOp\n */\n initializeUnorderedBulkOp(\n options?: CollectionOptions,\n ): UnorderedBulkOperation\n\n // http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#insertOne\n /** @deprecated Use insertOne, insertMany or bulkWrite */\n insert(docs: Object, callback: MongoCallback<InsertOneWriteOpResult>): void\n /** @deprecated Use insertOne, insertMany or bulkWrite */\n insert(\n docs: Object,\n options?: CollectionInsertOneOptions,\n ): Promise<InsertOneWriteOpResult>\n /** @deprecated Use insertOne, insertMany or bulkWrite */\n insert(\n docs: Object,\n options: CollectionInsertOneOptions,\n callback: MongoCallback<InsertOneWriteOpResult>,\n ): void\n\n /**\n * InsertMany.\n *\n * @param docs Documents to insert.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#insertMany\n */\n insertMany(\n docs: Object[],\n callback: MongoCallback<InsertWriteOpResult>,\n ): void\n\n /**\n * InsertMany.\n *\n * @param docs Documents to insert.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#insertMany\n */\n insertMany(\n docs: Object[],\n options?: CollectionInsertManyOptions,\n ): Promise<InsertWriteOpResult>\n\n /**\n * InsertMany.\n *\n * @param docs Documents to insert.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#insertMany\n */\n insertMany(\n docs: Object[],\n options: CollectionInsertManyOptions,\n callback: MongoCallback<InsertWriteOpResult>,\n ): void\n\n /**\n * InsertOne.\n *\n * @param docs Document to insert.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#insertOne\n */\n insertOne(\n docs: Object,\n callback: MongoCallback<InsertOneWriteOpResult>,\n ): void\n\n /**\n * InsertOne.\n *\n * @param docs Document to insert.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#insertOne\n */\n insertOne(\n docs: Object,\n options?: CollectionInsertOneOptions,\n ): Promise<InsertOneWriteOpResult>\n\n /**\n * InsertOne.\n *\n * @param docs Document to insert.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#insertOne\n */\n insertOne(\n docs: Object,\n options: CollectionInsertOneOptions,\n callback: MongoCallback<InsertOneWriteOpResult>,\n ): void\n\n /**\n * Returns if the collection is a capped collection.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#isCapped\n */\n isCapped(): Promise<any>\n\n /**\n * Returns if the collection is a capped collection.\n *\n * @param callback The results callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#isCapped\n */\n isCapped(callback: MongoCallback<any>): void\n\n /**\n * Get the list of all indexes information for the collection.\n *\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#listIndexes\n */\n listIndexes(options?: ListIndexesOptions): CommandCursor\n\n /**\n * Run Map Reduce across a collection. Be aware that the inline option for out will return an array of results not a collection.\n *\n * @param map The mapping function.\n * @param reduce The reduce function.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#mapReduce\n */\n mapReduce(\n map: Function | string,\n reduce: Function | string,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Run Map Reduce across a collection. Be aware that the inline option for out will return an array of results not a collection.\n *\n * @param map The mapping function.\n * @param reduce The reduce function.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#mapReduce\n */\n mapReduce(\n map: Function | string,\n reduce: Function | string,\n options?: MapReduceOptions,\n ): Promise<any>\n\n /**\n * Run Map Reduce across a collection. Be aware that the inline option for out will return an array of results not a collection.\n *\n * @param map The mapping function.\n * @param reduce The reduce function.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#mapReduce\n */\n mapReduce(\n map: Function | string,\n reduce: Function | string,\n options: MapReduceOptions,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Returns the options of the collection.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#options\n */\n options(): Promise<any>\n\n /**\n * Returns the options of the collection.\n *\n * @param callback The results callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#options\n */\n options(callback: MongoCallback<any>): void\n\n /**\n * Return N number of parallel cursors for a collection allowing parallel reading of entire collection. There are\n * no ordering guarantees for returned results.\n *\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#parallelCollectionScan\n */\n parallelCollectionScan(callback: MongoCallback<Cursor<any>[]>): void\n\n /**\n * Return N number of parallel cursors for a collection allowing parallel reading of entire collection. There are\n * no ordering guarantees for returned results.\n *\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#parallelCollectionScan\n */\n parallelCollectionScan(\n options?: ParallelCollectionScanOptions,\n ): Promise<Cursor<any>[]>\n\n /**\n * Return N number of parallel cursors for a collection allowing parallel reading of entire collection. There are\n * no ordering guarantees for returned results.\n *\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#parallelCollectionScan\n */\n parallelCollectionScan(\n options: ParallelCollectionScanOptions,\n callback: MongoCallback<Cursor<any>[]>,\n ): void\n\n /**\n * Reindex all indexes on the collection.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#reIndex\n */\n reIndex(): Promise<any>\n\n /**\n * Reindex all indexes on the collection.\n *\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#reIndex\n */\n reIndex(callback: MongoCallback<any>): void\n\n // http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#remove\n /** @deprecated Use use deleteOne, deleteMany or bulkWrite */\n remove(selector: Object, callback: MongoCallback<WriteOpResult>): void\n /** @deprecated Use use deleteOne, deleteMany or bulkWrite */\n remove(\n selector: Object,\n options?: CollectionOptions & { single?: boolean },\n ): Promise<WriteOpResult>\n /** @deprecated Use use deleteOne, deleteMany or bulkWrite */\n remove(\n selector: Object,\n options?: CollectionOptions & { single?: boolean },\n callback?: MongoCallback<WriteOpResult>,\n ): void\n\n /**\n * Rename the collection.\n *\n * @param newName New name of of the collection.\n * @param callback The results callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#rename\n */\n rename(newName: string, callback: MongoCallback<Collection<T>>): void\n\n /**\n * Rename the collection.\n *\n * @param newName New name of of the collection.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#rename\n */\n rename(\n newName: string,\n options?: { dropTarget?: boolean },\n ): Promise<Collection<T>>\n\n /**\n * Rename the collection.\n *\n * @param newName New name of of the collection.\n * @param options Optional settings.\n * @param callback The results callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#rename\n */\n rename(\n newName: string,\n options: { dropTarget?: boolean },\n callback: MongoCallback<Collection<T>>,\n ): void\n\n /**\n * Replace a document on MongoDB.\n *\n * @param filter The Filter used to select the document to update.\n * @param doc The Document that replaces the matching document.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#replaceOne\n */\n replaceOne(\n filter: FilterQuery<T>,\n doc: Object,\n callback: MongoCallback<UpdateWriteOpResult>,\n ): void\n\n /**\n * Replace a document on MongoDB.\n *\n * @param filter The Filter used to select the document to update.\n * @param doc The Document that replaces the matching document.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#replaceOne\n */\n replaceOne(\n filter: FilterQuery<T>,\n doc: Object,\n options?: ReplaceOneOptions,\n ): Promise<UpdateWriteOpResult>\n\n /**\n * Replace a document on MongoDB.\n *\n * @param filter The Filter used to select the document to update.\n * @param doc The Document that replaces the matching document.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#replaceOne\n */\n replaceOne(\n filter: FilterQuery<T>,\n doc: Object,\n options: ReplaceOneOptions,\n callback: MongoCallback<UpdateWriteOpResult>,\n ): void\n\n // http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#save\n /** @deprecated Use insertOne, insertMany, updateOne or updateMany */\n save(doc: Object, callback: MongoCallback<WriteOpResult>): void\n /** @deprecated Use insertOne, insertMany, updateOne or updateMany */\n save(doc: Object, options?: CollectionOptions): Promise<WriteOpResult>\n /** @deprecated Use insertOne, insertMany, updateOne or updateMany */\n save(\n doc: Object,\n options: CollectionOptions,\n callback: MongoCallback<WriteOpResult>,\n ): void\n\n /**\n * Get all the collection statistics.\n *\n * @param callback The collection result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#stats\n */\n stats(callback: MongoCallback<CollStats>): void\n\n /**\n * Get all the collection statistics.\n *\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#stats\n */\n stats(options?: { scale: number }): Promise<CollStats>\n\n /**\n * Get all the collection statistics.\n *\n * @param options Optional settings.\n * @param callback The collection result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#stats\n */\n stats(options: { scale: number }, callback: MongoCallback<CollStats>): void\n\n // http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#update\n /** @deprecated use updateOne, updateMany or bulkWrite */\n update(\n filter: FilterQuery<T>,\n update: UpdateQuery<T>,\n callback: MongoCallback<WriteOpResult>,\n ): void\n /** @deprecated use updateOne, updateMany or bulkWrite */\n update(\n filter: FilterQuery<T>,\n update: UpdateQuery<T>,\n options?: ReplaceOneOptions & { multi?: boolean },\n ): Promise<WriteOpResult>\n /** @deprecated use updateOne, updateMany or bulkWrite */\n update(\n filter: FilterQuery<T>,\n update: UpdateQuery<T>,\n options: ReplaceOneOptions & { multi?: boolean },\n callback: MongoCallback<WriteOpResult>,\n ): void\n\n /**\n * Update multiple documents on MongoDB.\n *\n * @param filter The Filter used to select the document to update.\n * @param update The update operations to be applied to the document.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#updateMany\n */\n updateMany(\n filter: FilterQuery<T>,\n update: UpdateQuery<T>,\n callback: MongoCallback<UpdateWriteOpResult>,\n ): void\n\n /**\n * Update multiple documents on MongoDB.\n *\n * @param filter The Filter used to select the document to update.\n * @param update The update operations to be applied to the document.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#updateMany\n */\n updateMany(\n filter: FilterQuery<T>,\n update: UpdateQuery<T>,\n options?: UpdateManyOptions,\n ): Promise<UpdateWriteOpResult>\n\n /**\n * Update multiple documents on MongoDB.\n *\n * @param filter The Filter used to select the document to update.\n * @param update The update operations to be applied to the document.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#updateMany\n */\n updateMany(\n filter: FilterQuery<T>,\n update: UpdateQuery<T>,\n options: UpdateManyOptions,\n callback: MongoCallback<UpdateWriteOpResult>,\n ): void\n\n /**\n * Update a single document on MongoDB.\n *\n * @param filter The Filter used to select the document to update.\n * @param update The update operations to be applied to the document.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#updateOne\n */\n updateOne(\n filter: FilterQuery<T>,\n update: UpdateQuery<T>,\n callback: MongoCallback<UpdateWriteOpResult>,\n ): void\n\n /**\n * Update a single document on MongoDB.\n *\n * @param filter The Filter used to select the document to update.\n * @param update The update operations to be applied to the document.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#updateOne\n */\n updateOne(\n filter: FilterQuery<T>,\n update: UpdateQuery<T>,\n options?: ReplaceOneOptions,\n ): Promise<UpdateWriteOpResult>\n\n /**\n * Update a single document on MongoDB.\n *\n * @param filter The Filter used to select the document to update.\n * @param update The update operations to be applied to the document.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#updateOne\n */\n updateOne(\n filter: FilterQuery<T>,\n update: UpdateQuery<T>,\n options: ReplaceOneOptions,\n callback: MongoCallback<UpdateWriteOpResult>,\n ): void\n\n /**\n * Create a new Change Stream, watching for new changes (insertions, updates, replacements, deletions, and invalidations) in this collection.\n * @param pipeline An array of aggregation pipeline stages through which to pass change stream documents. This allows for filtering (using $match) and manipulating the change stream documents.\n * @param options Optional settings.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#watch\n */\n watch(\n pipeline?: Object[],\n options?: ChangeStreamOptions & {\n startAtClusterTime?: Timestamp\n session?: ClientSession\n },\n ): ChangeStream\n}\n\n/**\n * Condition.\n */\nexport type Condition<T, P extends keyof T> = {\n $eq?: T[P]\n $gt?: T[P]\n $gte?: T[P]\n $in?: T[P][]\n $lt?: T[P]\n $lte?: T[P]\n $ne?: T[P]\n $nin?: T[P][]\n $and?: (FilterQuery<T[P]> | T[P])[]\n $or?: (FilterQuery<T[P]> | T[P])[]\n $not?: (FilterQuery<T[P]> | T[P])[] | T[P]\n $expr?: any\n $jsonSchema?: any\n $mod?: [number, number]\n $regex?: RegExp\n $options?: string\n $text?: {\n $search: string\n $language?: string\n $caseSensitive?: boolean\n $diacraticSensitive?: boolean\n }\n $where?: Object\n $geoIntersects?: Object\n $geoWithin?: Object\n $near?: Object\n $nearSphere?: Object\n $elemMatch?: Object\n $size?: number\n $bitsAllClear?: Object\n $bitsAllSet?: Object\n $bitsAnyClear?: Object\n $bitsAnySet?: Object\n [key: string]: any\n}\n\n/**\n * @see https://docs.mongodb.com/manual/reference/operator/update\n */\nexport type UpdateQuery<T> = {\n $inc?: { [P in keyof T]?: number } | { [key: string]: number }\n $min?: { [P in keyof T]?: number } | { [key: string]: number }\n $max?: { [P in keyof T]?: number } | { [key: string]: number }\n $mul?: { [P in keyof T]?: number } | { [key: string]: number }\n $set?: Partial<T> | { [key: string]: any }\n $setOnInsert?: Partial<T> | { [key: string]: any }\n $unset?: { [P in keyof T]?: \"\" } | { [key: string]: \"\" }\n $rename?: { [key: string]: keyof T } | { [key: string]: string }\n $currentDate?:\n | { [P in keyof T]?: true | { $type: \"date\" | \"timestamp\" } }\n | { [key: string]: true | { $type: \"date\" | \"timestamp\" } }\n $addToSet?: Partial<T> | { [key: string]: any }\n $pop?: { [P in keyof T]?: -1 | 1 } | { [key: string]: -1 | 1 }\n $pull?: Partial<T> | { [key: string]: Condition<T, keyof T> }\n $push?: Partial<T> | { [key: string]: any }\n $pushAll?: Partial<T> | { [key: string]: Array<any> }\n $each?: Partial<T> | { [key: string]: Array<any> }\n $bit?: { [P in keyof T]?: any } | { [key: string]: any }\n}\n\nexport type FilterQuery<T> =\n | {\n [P in keyof T]?: T[P] | Condition<T, P>\n }\n | { [key: string]: any }\n\n/**\n * The name of the target collection.\n *\n * @see http://docs.mongodb.org/manual/reference/command/collStats/\n */\nexport interface CollStats {\n /**\n * Namespace.\n */\n ns: string\n\n /**\n * The number of objects or documents in this collection.\n */\n count: number\n\n /**\n * Collection size in bytes.\n */\n size: number\n\n /**\n * Average object size in bytes.\n */\n avgObjSize: number\n\n /**\n * (Pre)allocated space for the collection in bytes.\n */\n storageSize: number\n\n /**\n * Number of extents (contiguously allocated chunks of datafile space).\n */\n numExtents: number\n\n /**\n * Number of indexes.\n */\n nindexes: number\n\n /**\n * Size of the most recently created extent in bytes.\n */\n lastExtentSize: number\n\n /**\n * Padding can speed up updates if documents grow.\n */\n paddingFactor: number\n\n /**\n * A number that indicates the user-set flags on the collection. userFlags\n * only appears when using the mmapv1 storage engine.\n */\n userFlags: number\n\n /**\n * Total index size in bytes.\n */\n totalIndexSize: number\n\n /**\n * Size of specific indexes in bytes.\n */\n indexSizes: {\n _id_: number\n username: number\n }\n\n /**\n * This field will be “true” if the collection is capped.\n */\n capped: boolean\n\n /**\n * Shows the maximum size of a capped collection.\n */\n maxSize: boolean\n\n /**\n * This document contains data reported directly by the WiredTiger engine and other data for internal diagnostic use.\n */\n wiredTiger: any\n\n /**\n * A document that reports data from the WiredTiger storage engine for each index in the collection.\n * Other storage engines will return an empty document.\n */\n indexDetails: any\n\n /**\n *\n */\n ok: number\n}\n\n/**\n * CollectionAggregationOptions.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#aggregate\n */\nexport interface CollectionAggregationOptions {\n readPreference?: ReadPreference | string\n\n /**\n * Return the query as cursor, on 2.6 > it returns as a real cursor on pre 2.6 it returns as an emulated cursor.\n */\n cursor?: { batchSize: number }\n\n /**\n * Explain returns the aggregation execution plan (requires mongodb 2.6 >).\n */\n explain?: boolean\n\n /**\n * allowDiskUse lets the server know if it can use disk to store temporary results for the aggregation (requires mongodb 2.6 >).\n */\n allowDiskUse?: boolean\n\n /**\n * maxTimeMS specifies a cumulative time limit in milliseconds for processing operations on the cursor. MongoDB interrupts the operation at the earliest following interrupt point.\n */\n maxTimeMS?: boolean\n\n /**\n * Allow driver to bypass schema validation in MongoDB 3.2 or higher.\n */\n bypassDocumentValidation?: boolean\n}\n\n/**\n * CollectionInsertManyOptions.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#insertMany\n */\nexport interface CollectionInsertManyOptions {\n /**\n * The write concern.\n */\n w?: number | string\n\n /**\n * The write concern timeout.\n */\n wtimeout?: number\n\n /**\n * Specify a journal write concern.\n */\n j?: boolean\n\n /**\n * Serialize functions on any object.\n */\n serializeFunctions?: boolean\n\n /**\n * Force server to assign _id values instead of driver.\n */\n forceServerObjectId?: boolean\n}\n\nexport interface UpdateManyOptions {\n /**\n * Update operation is an upsert.\n */\n upsert?: boolean\n\n /**\n * The write concern.\n */\n w?: any\n\n /**\n * The write concern timeout.\n */\n wtimeout?: number\n\n /**\n * Specify a journal write concern.\n */\n j?: boolean\n}\n\n/**\n * CollectionBulkWriteOptions.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#bulkWrite\n */\nexport interface CollectionBulkWriteOptions {\n /**\n * The write concern.\n */\n w?: number | string\n\n /**\n * The write concern timeout.\n */\n wtimeout?: number\n\n /**\n * Specify a journal write concern.\n */\n j?: boolean\n\n /**\n * Serialize functions on any object.\n */\n serializeFunctions?: boolean\n\n /**\n * Execute write operation in ordered or unordered fashion.\n */\n ordered?: boolean\n\n /**\n * Allow driver to bypass schema validation in MongoDB 3.2 or higher.\n */\n bypassDocumentValidation?: boolean\n}\n\n/**\n * BulkWriteOpResultObject.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#~BulkWriteOpResult\n */\nexport interface BulkWriteOpResultObject {\n /**\n * Number of documents inserted.\n */\n insertedCount?: number\n\n /**\n * Number of documents matched for update.\n */\n matchedCount?: number\n\n /**\n * Number of documents modified.\n */\n modifiedCount?: number\n\n /**\n * Number of documents deleted.\n */\n deletedCount?: number\n\n /**\n * Number of documents upserted.\n */\n upsertedCount?: number\n\n /**\n * Inserted document generated Id's, hash key is the index of the originating operation.\n */\n insertedIds?: any\n\n /**\n * Upserted document generated Id's, hash key is the index of the originating operation.\n */\n upsertedIds?: any\n\n /**\n * The command result object.\n */\n result?: any\n}\n\n/**\n * MongoCountPreferences.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#count\n */\nexport interface MongoCountPreferences {\n /**\n * The limit of documents to count.\n */\n limit?: number\n\n /**\n * The number of documents to skip for the count.\n */\n skip?: boolean\n\n /**\n * An index name hint for the query.\n */\n hint?: string\n\n /**\n * The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED,\n * ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).\n */\n readPreference?: ReadPreference | string\n}\n\n/**\n * DeleteWriteOpResultObject.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#~deleteWriteOpResult\n */\nexport interface DeleteWriteOpResultObject {\n /**\n * The raw result returned from MongoDB, field will vary depending on server version.\n * @param ok Is 1 if the command executed correctly.\n * @param n The total count of documents deleted.\n */\n result: {\n ok?: number\n n?: number\n }\n\n /**\n * The connection object used for the operation.\n */\n connection?: any\n\n /**\n * The number of documents deleted.\n */\n deletedCount?: number\n}\n\n/**\n * FindAndModifyWriteOpResultObject.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#~findAndModifyWriteOpResult\n */\nexport interface FindAndModifyWriteOpResultObject {\n /**\n * Document returned from findAndModify command.\n */\n value?: any\n\n /**\n * The raw lastErrorObject returned from the command.\n */\n lastErrorObject?: any\n\n /**\n * Is 1 if the command executed correctly.\n */\n ok?: number\n}\n\n/**\n * FindOneAndReplaceOption.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#findOneAndReplace\n */\nexport interface FindOneAndReplaceOption {\n /**\n * Limits the fields to return for all matching documents.\n */\n projection?: Object\n\n /**\n * Determines which document the operation modifies if the query selects multiple documents.\n */\n sort?: Object\n\n /**\n * The maximum amount of time to allow the query to run.\n */\n maxTimeMS?: number\n\n /**\n * Upsert the document if it does not exist.\n */\n upsert?: boolean\n\n /**\n * When false, returns the updated document rather than the original. The default is true.\n */\n returnOriginal?: boolean\n}\n\n/**\n * GeoHaystackSearchOptions.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#geoHaystackSearch\n */\nexport interface GeoHaystackSearchOptions {\n /**\n * The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED,\n * ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).\n */\n readPreference?: ReadPreference | string\n\n /**\n * Include results up to maxDistance from the point.\n */\n maxDistance?: number\n\n /**\n * Filter the results by a query.\n */\n search?: Object\n\n /**\n * Max number of results to return.\n */\n limit?: number\n}\n\n/**\n * GeoNearOptions.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#geoNear\n */\nexport interface GeoNearOptions {\n /**\n * The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED,\n * ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).\n */\n readPreference?: ReadPreference | string\n\n /**\n * Max number of results to return.\n */\n num?: number\n\n /**\n * Include results starting at minDistance from a point (2.6 or higher).\n */\n minDistance?: number\n\n /**\n * Include results up to maxDistance from the point.\n */\n maxDistance?: number\n\n /**\n * Include a value to multiply the distances with allowing for range conversions.\n */\n distanceMultiplier?: number\n\n /**\n * Filter the results by a query.\n */\n query?: Object\n\n /**\n * Perform query using a spherical model.\n */\n spherical?: boolean\n\n /**\n * The closest location in a document to the center of the search region will always be returned MongoDB > 2.X.\n */\n uniqueDocs?: boolean\n\n /**\n * Include the location data fields in the top level of the results MongoDB > 2.X.\n */\n includeLocs?: boolean\n}\n\n/**\n * A class representation of the BSON Code type.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Code.html\n */\nexport declare class Code {\n /**\n *\n * @param code a string or function.\n * @param scope optional\n */\n constructor(code: string | Function, scope?: Object)\n\n /**\n * A string or function.\n */\n code: string | Function\n\n /**\n * An optional scope for the function.\n */\n scope: any\n}\n\n/**\n * CollectionOptions.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#deleteMany\n */\nexport interface CollectionOptions {\n /**\n * The write concern.\n */\n w?: number | string\n\n /**\n * The write concern timeout.\n */\n wtimeout?: number\n\n /**\n * Specify a journal write concern.\n */\n j?: boolean\n}\n\n/**\n * Create a new OrderedBulkOperation instance (INTERNAL TYPE, do not instantiate directly).\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/OrderedBulkOperation.html\n */\nexport interface OrderedBulkOperation {\n /**\n * Get the number of operations in the bulk.\n */\n length: number\n\n /**\n * Execute the ordered bulk operation.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/OrderedBulkOperation.html#execute\n */\n execute(callback: MongoCallback<BulkWriteResult>): void\n\n /**\n * Execute the ordered bulk operation.\n * @param options optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/OrderedBulkOperation.html#execute\n */\n execute(options?: FSyncOptions): Promise<BulkWriteResult>\n\n /**\n * Execute the ordered bulk operation.\n * @param options Optional settings.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/OrderedBulkOperation.html#execute\n */\n execute(\n options: FSyncOptions,\n callback: MongoCallback<BulkWriteResult>,\n ): void\n\n /**\n * Initiate a find operation for an update/updateOne/remove/removeOne/replaceOne.\n * @param selector The selector for the bulk operation.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/OrderedBulkOperation.html#find\n */\n find(selector: Object): FindOperatorsOrdered\n\n /**\n * Add a single insert document to the bulk operation.\n * @param doc The document to insert\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/OrderedBulkOperation.html#insert\n */\n insert(doc: Object): OrderedBulkOperation\n}\n\n/**\n * BulkWriteResult.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/BulkWriteResult.html\n */\nexport interface BulkWriteResult {\n /**\n * Did bulk operation correctly execute.\n */\n ok: number\n\n /**\n * number of inserted documents.\n */\n nInserted: number\n\n /**\n * number of documents updated logically.\n */\n nUpdated: number\n\n /**\n * Number of upserted documents.\n */\n nUpserted: number\n\n /**\n *\n Number of documents updated physically on disk.\n */\n nModified: number\n\n /**\n * Number of removed documents.\n */\n nRemoved: number\n\n /**\n * Return an array of inserted ids.\n */\n getInsertedIds(): Array<Object>\n\n /**\n * Retrieve lastOp if available.\n */\n getLastOp(): Object\n\n /**\n * Return raw internal result.\n */\n getRawResponse(): Object\n\n /**\n * Return the upserted id at position x.\n */\n getUpsertedIdAt(index: number): Object\n\n /**\n * Return an array of upserted ids.\n */\n getUpsertedIds(): Array<{ _id: string; index: number }>\n\n /**\n * Retrieve the write concern error if any.\n */\n getWriteConcernError(): WriteConcernError\n\n /**\n * Returns a specific write error object.\n */\n getWriteErrorAt(index: number): WriteError\n\n /**\n * Returns the number of write errors off the bulk operation.\n */\n getWriteErrorCount(): number\n\n /**\n * Retrieve all write errors.\n */\n getWriteErrors(): Array<Object>\n\n /**\n * Returns true if the bulk operation contains a write error.\n */\n hasWriteErrors(): boolean\n}\n\n/**\n * Create a new WriteError instance (INTERNAL TYPE, do not instantiate directly).\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/WriteError.html\n */\nexport interface WriteError {\n /**\n * Write concern error code.\n */\n code: number\n\n /**\n * Write concern error original bulk operation index.\n */\n index: number\n\n /**\n * Write concern error message.\n */\n errmsg: string\n}\n\n/**\n * Create a new WriteConcernError instance (INTERNAL TYPE, do not instantiate directly).\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/WriteConcernError.html\n */\nexport interface WriteConcernError {\n /**\n * Write concern error code.\n */\n code: number\n\n /**\n * Write concern error message.\n */\n errmsg: string\n}\n\n/**\n * Create a FindOperatorsOrdered instance (INTERNAL TYPE, do not instantiate directly).\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/FindOperatorsOrdered.html\n */\nexport interface FindOperatorsOrdered {\n /**\n * Add a remove operation to the bulk operation.\n */\n delete(): OrderedBulkOperation\n\n /**\n * Add a remove one operation to the bulk operation.\n */\n deleteOne(): OrderedBulkOperation\n\n /**\n * Add a replace one operation to the bulk operation.\n */\n replaceOne(doc: Object): OrderedBulkOperation\n\n /**\n * Add a single update document to the bulk operation.\n */\n update(doc: Object): OrderedBulkOperation\n\n /**\n * Add a single update one document to the bulk operation.\n */\n updateOne(doc: Object): OrderedBulkOperation\n\n /**\n * Upsert modifier for update bulk operation.\n */\n upsert(): FindOperatorsOrdered\n}\n\n/**\n * Create a new UnorderedBulkOperation instance (INTERNAL TYPE, do not instantiate directly).\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/UnorderedBulkOperation.html\n */\nexport interface UnorderedBulkOperation {\n /**\n * Get the number of operations in the bulk.\n */\n length: number\n\n /**\n * Execute the ordered bulk operation.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/UnorderedBulkOperation.html#execute\n */\n execute(callback: MongoCallback<BulkWriteResult>): void\n\n /**\n * Execute the ordered bulk operation.\n * @param options optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/UnorderedBulkOperation.html#execute\n */\n execute(options?: FSyncOptions): Promise<BulkWriteResult>\n\n /**\n * Execute the ordered bulk operation.\n * @param options Optional settings.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/UnorderedBulkOperation.html#execute\n */\n execute(\n options: FSyncOptions,\n callback: MongoCallback<BulkWriteResult>,\n ): void\n\n /**\n * Initiate a find operation for an update/updateOne/remove/removeOne/replaceOne.\n * @param selector The selector for the bulk operation.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/UnorderedBulkOperation.html#find\n */\n find(selector: Object): FindOperatorsUnordered\n\n /**\n * Add a single insert document to the bulk operation.\n * @param doc The document to insert.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/UnorderedBulkOperation.html#insert\n */\n insert(doc: Object): UnorderedBulkOperation\n}\n\n/**\n * Create a FindOperatorsUnordered instance (INTERNAL TYPE, do not instantiate directly).\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/FindOperatorsUnordered.html\n */\nexport interface FindOperatorsUnordered {\n /**\n * Get the number of operations in the bulk.\n */\n length: number\n\n /**\n * Add a remove operation to the bulk operation.\n */\n remove(): UnorderedBulkOperation\n\n /**\n * Add a remove one operation to the bulk operation.\n */\n removeOne(): UnorderedBulkOperation\n\n /**\n * Add a replace one operation to the bulk operation.\n * @param doc The new document to replace the existing one with.\n */\n replaceOne(doc: Object): UnorderedBulkOperation\n\n /**\n * Add a single update document to the bulk operation.\n * @param doc Update operations\n */\n update(doc: Object): UnorderedBulkOperation\n\n /**\n * Add a single update one document to the bulk operation.\n * @param doc Update operations\n */\n updateOne(doc: Object): UnorderedBulkOperation\n\n /**\n * Upsert modifier for update bulk operation.\n */\n upsert(): FindOperatorsUnordered\n}\n\n/**\n * MongodbFindOneOptions.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#findOne\n */\nexport interface MongodbFindOneOptions {\n /**\n * Sets the limit of documents returned in the query.\n */\n limit?: number\n\n /**\n * Set to sort the documents coming back from the query. Array of indexes, [['a', 1]] etc.\n */\n sort?: Array<any> | Object\n\n /**\n * The fields to return in the query. Object of fields to include or exclude (not both), {'a':1}.\n */\n fields?: Object\n\n /**\n * Set to skip N documents ahead in your query (useful for pagination).\n */\n skip?: number\n\n /**\n * Tell the query to use specific indexes in the query. Object of indexes to use, {'_id':1}.\n */\n hint?: Object\n\n /**\n * Explain the query instead of returning the data.\n */\n explain?: boolean\n\n /**\n * Snapshot query.\n */\n snapshot?: boolean\n\n /**\n * Specify if the cursor can timeout.\n */\n timeout?: boolean\n\n /**\n * Specify if the cursor is tailable.\n */\n tailable?: boolean\n\n /**\n * Set the batchSize for the getMoreCommand when iterating over the query results.\n */\n batchSize?: number\n\n /**\n * Only return the index key.\n */\n returnKey?: boolean\n\n /**\n * Limit the number of items to scan.\n */\n maxScan?: number\n\n /**\n * Set index bounds.\n */\n min?: number\n\n /**\n * Set index bounds.\n */\n max?: number\n\n /**\n * Show disk location of results.\n */\n showDiskLoc?: boolean\n\n /**\n * You can put a $comment field on a query to make looking in the profiler logs simpler.\n */\n comment?: string\n\n /**\n * Return document results as raw BSON buffers.\n */\n raw?: boolean\n\n /**\n * The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED,\n * ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).\n */\n readPreference?: ReadPreference | string\n\n /**\n * Specify if the cursor should return partial results when querying against a sharded system.\n */\n partial?: boolean\n\n /**\n * Number of milliseconds to wait before aborting the query.\n */\n maxTimeMs?: number\n}\n\n/**\n * InsertWriteOpResult.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#~insertWriteOpResult\n */\nexport interface InsertWriteOpResult {\n /**\n * The total amount of documents inserted.\n */\n insertedCount: number\n\n /**\n * All the documents inserted using insertOne/insertMany/replaceOne.\n * Documents contain the _id field if forceServerObjectId == false for insertOne/insertMany.\n */\n ops: Array<any>\n\n /**\n * All the generated _id's for the inserted documents.\n */\n insertedIds: Array<ObjectID>\n\n /**\n * The connection object used for the operation.\n */\n connection: any\n\n /**\n * The raw command result object returned from MongoDB (content might vary by server version).\n * @param ok Is 1 if the command executed correctly.\n * @param n The total count of documents inserted.\n */\n result: { ok: number; n: number }\n}\n\n/**\n * CollectionInsertOneOptions.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#insertOne\n */\nexport interface CollectionInsertOneOptions {\n /**\n * The write concern.\n */\n w?: number | string\n\n /**\n * The write concern timeout.\n */\n wtimeout?: number\n\n /**\n * Specify a journal write concern.\n */\n j?: boolean\n\n /**\n * Serialize functions on any object.\n */\n serializeFunctions?: boolean\n\n /**\n * Force server to assign _id values instead of driver.\n */\n forceServerObjectId?: boolean\n\n /**\n * Allow driver to bypass schema validation in MongoDB 3.2 or higher.\n */\n bypassDocumentValidation?: boolean\n}\n\n/**\n * InsertOneWriteOpResult.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#~insertOneWriteOpResult\n */\nexport interface InsertOneWriteOpResult {\n /**\n * The total amount of documents inserted.\n */\n insertedCount: number\n\n /**\n * All the documents inserted using insertOne/insertMany/replaceOne.\n * Documents contain the _id field if forceServerObjectId == false for insertOne/insertMany.\n */\n ops: Array<any>\n\n /**\n * The driver generated ObjectId for the insert operation.\n */\n insertedId: ObjectID\n\n /**\n * The connection object used for the operation.\n */\n connection: any\n\n /**\n * The raw command result object returned from MongoDB (content might vary by server version).\n * @param ok Is 1 if the command executed correctly.\n * @param n The total count of documents inserted.\n */\n result: { ok: number; n: number }\n}\n\n/**\n * ParallelCollectionScanOptions.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#parallelCollectionScan\n */\nexport interface ParallelCollectionScanOptions {\n /**\n * The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED,\n * ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).\n */\n readPreference?: ReadPreference | string\n\n /**\n * Set the batchSize for the getMoreCommand when iterating over the query results.\n */\n batchSize?: number\n\n /**\n * The maximum number of parallel command cursors to return (the number of returned cursors will be in the range 1:numCursors).\n */\n numCursors?: number\n\n /**\n * Return all BSON documents as Raw Buffer documents.\n */\n raw?: boolean\n}\n\n/**\n * ParallelCollectionScanOptions.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#replaceOne\n */\nexport interface ReplaceOneOptions {\n /**\n * Update operation is an upsert.\n */\n upsert?: boolean\n\n /**\n * The write concern.\n */\n w?: number | string\n\n /**\n * The write concern timeout.\n */\n wtimeout?: number\n\n /**\n * Specify a journal write concern.\n */\n j?: boolean\n\n /**\n * Allow driver to bypass schema validation in MongoDB 3.2 or higher.\n */\n bypassDocumentValidation?: boolean\n}\n\n/**\n * ParallelCollectionScanOptions.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#~updateWriteOpResult\n */\nexport interface UpdateWriteOpResult {\n /**\n * The raw result returned from MongoDB, field will vary depending on server version.\n * @param ok Is 1 if the command executed correctly.\n * @param n The total count of documents scanned.\n * @param nModified The total count of documents modified.\n */\n result: { ok: number; n: number; nModified: number }\n\n /**\n * The connection object used for the operation.\n */\n connection: any\n\n /**\n * The number of documents that matched the filter.\n */\n matchedCount: number\n\n /**\n * The number of documents that were modified.\n */\n modifiedCount: number\n\n /**\n * The number of documents upserted.\n */\n upsertedCount: number\n\n /**\n * The upserted id.\n * @param _id The upserted _id returned from the server.\n */\n upsertedId: { _id: ObjectID }\n}\n\n/**\n * ParallelCollectionScanOptions.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#mapReduce\n */\nexport interface MapReduceOptions {\n /**\n * The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED,\n * ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).\n */\n readPreference?: ReadPreference | string\n\n /**\n * Sets the output target for the map reduce job.\n * {inline:1} | {replace:'collectionName'} | {merge:'collectionName'} | {reduce:'collectionName'}.\n */\n out?: Object\n\n /**\n * Query filter object.\n */\n query?: Object\n\n /**\n * Sorts the input objects using this key. Useful for optimization, like sorting by the emit key for fewer reduces.\n */\n sort?: Object\n\n /**\n * Number of objects to return from collection.\n */\n limit?: number\n\n /**\n * Keep temporary data.\n */\n keeptemp?: boolean\n\n /**\n * Finalize function.\n */\n finalize?: Function | string\n\n /**\n * Can pass in variables that can be access from map/reduce/finalize.\n */\n scope?: Object\n\n /**\n * It is possible to make the execution stay in JS. Provided in MongoDB > 2.0.X.\n */\n jsMode?: boolean\n\n /**\n * Provide statistics on job execution time.\n */\n verbose?: boolean\n\n /**\n * Allow driver to bypass schema validation in MongoDB 3.2 or higher.\n */\n bypassDocumentValidation?: boolean\n}\n\n/**\n * WriteOpResult.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#~WriteOpResult\n */\nexport interface WriteOpResult {\n /**\n * All the documents inserted using insertOne/insertMany/replaceOne.\n * Documents contain the _id field if forceServerObjectId == false for insertOne/insertMany.\n */\n ops: Array<any>\n\n /**\n * The connection object used for the operation.\n */\n connection: any\n\n /**\n * The command result object.\n */\n result: any\n}\n\n/**\n * WriteOpResult.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#~resultCallback\n */\nexport type CursorResult = any | void | boolean\n\n/**\n * Creates a new Cursor instance (INTERNAL TYPE, do not instantiate directly).\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html\n */\nexport declare class Cursor<T> extends Readable {\n [Symbol.asyncIterator](): AsyncIterableIterator<T>\n\n /**\n * Cursor query sort setting.\n */\n sortValue: string\n\n /**\n * Is Cursor able to time out.\n */\n timeout: boolean\n\n /**\n * Get cursor ReadPreference.\n */\n readPreference: ReadPreference\n\n /**\n * @param flag The flag to set, must be one of following ['tailable', 'oplogReplay', 'noCursorTimeout', 'awaitData', 'partial'].\n * @param value The flag boolean value.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#addCursorFlag\n */\n addCursorFlag(flag: string, value: boolean): Cursor<T>\n\n /**\n * @param name The query modifier (must start with $, such as $orderby etc).\n * @param value The flag boolean value.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#addQueryModifier\n */\n addQueryModifier(name: string, value: boolean): Cursor<T>\n\n /**\n * @param value The batchSize for the cursor.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#batchSize\n */\n batchSize(value: number): Cursor<T>\n\n /**\n * Clone the cursor.\n * still returns the same type.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#clone\n */\n clone(): Cursor<T>\n\n /**\n * Close the cursor, sending a KillCursor command and emitting close.\n * The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#close\n */\n close(): Promise<CursorResult>\n\n /**\n * Close the cursor, sending a KillCursor command and emitting close.\n * The result callback.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#close\n */\n close(callback: MongoCallback<CursorResult>): void\n\n /**\n * Add a comment to the cursor query allowing for tracking the comment in the log.\n * @param value The comment attached to this query.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#comment\n */\n comment(value: string): Cursor<T>\n\n /**\n * Get the count of documents for this cursor.\n * @param applySkipLimit Should the count command apply limit and skip settings on the cursor or in the passed in options.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#count\n */\n count(applySkipLimit: boolean, callback: MongoCallback<number>): void\n\n /**\n * Get the count of documents for this cursor.\n * @param applySkipLimit Should the count command apply limit and skip settings on the cursor or in the passed in options.\n * @param options Optional settings.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#count\n */\n count(\n applySkipLimit: boolean,\n options?: CursorCommentOptions,\n ): Promise<number>\n\n /**\n * Get the count of documents for this cursor.\n * @param applySkipLimit Should the count command apply limit and skip settings on the cursor or in the passed in options.\n * @param options Optional settings.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#count\n */\n count(\n applySkipLimit: boolean,\n options: CursorCommentOptions,\n callback: MongoCallback<number>,\n ): void\n\n /**\n * Execute the explain for the cursor.\n * returns Promise if no callback passed.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#explain\n */\n explain(): Promise<CursorResult>\n\n /**\n * Execute the explain for the cursor.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#explain\n */\n explain(callback: MongoCallback<CursorResult>): void\n\n /**\n * Set the cursor query.\n * @param filter The filter object used for the cursor.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#filter\n */\n filter(filter: Object): Cursor<T>\n\n /**\n * Iterates over all the documents for this cursor using the iterator, callback pattern.\n * @param iterator The iteration callback.\n * @param callback The end callback.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#forEach\n */\n forEach(iterator: IteratorCallback<T>, callback: EndCallback): void\n forEach(iterator: IteratorCallback<T>): Promise<void>\n\n /**\n * Check if there is any document still available in the cursor.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#hasNext\n */\n hasNext(): Promise<boolean>\n\n /**\n * Check if there is any document still available in the cursor.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#hasNext\n */\n hasNext(callback: MongoCallback<boolean>): void\n\n /**\n * Set the cursor hint.\n * @param hint If specified, then the query system will only consider plans using the hinted index.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#hint\n */\n hint(hint: Object): Cursor<T>\n\n /**\n * Is the cursor closed.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#isClosed\n */\n isClosed(): boolean\n\n /**\n * Set the limit for the cursor.\n * @param value The limit for the cursor query.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#limit\n */\n limit(value: number): Cursor<T>\n\n /**\n * SMap all documents using the provided function.\n * @param transform The mapping transformation method.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#map\n */\n map(transform: Function): Cursor<T>\n\n /**\n * Set the cursor max.\n * @param max Specify a $max value to specify the exclusive upper bound for a specific index in\n * order to constrain the results of find(). The $max specifies the upper bound for\n * all keys of a specific index in order.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#max\n */\n max(max: number): Cursor<T>\n\n /**\n * Set a maxAwaitTimeMS on a tailing cursor query to allow to customize the\n * timeout value for the option awaitData (Only supported on MongoDB 3.2 or higher, ignored otherwise).\n * @param value Number of milliseconds to wait before aborting the tailed query.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#maxAwaitTimeMS\n */\n maxAwaitTimeMS(value: number): Cursor<T>\n\n /**\n * Set the cursor maxScan.\n * @param maxScan Constrains the query to only scan the specified number of documents when fulfilling the query.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#maxScan\n */\n maxScan(maxScan: Object): Cursor<T>\n\n /**\n * Set a maxTimeMS on the cursor query, allowing for hard timeout limits on queries (Only supported on MongoDB 2.6 or higher).\n * @param value Number of milliseconds to wait before aborting the query.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#maxTimeMS\n */\n maxTimeMS(value: number): Cursor<T>\n\n /**\n * Set the cursor min.\n * @param min Specify a $min value to specify the inclusive lower bound for a specific index in order to\n * constrain the results of find(). The $min specifies the lower bound for all keys of a specific index in order.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#min\n */\n min(min: number): Cursor<T>\n\n /**\n * Get the next available document from the cursor, returns null if no more documents are available.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#next\n */\n next(): Promise<CursorResult>\n\n /**\n * Get the next available document from the cursor, returns null if no more documents are available.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#next\n */\n next(callback: MongoCallback<CursorResult>): void\n\n /**\n * Sets a field projection for the query.\n * @param value The field projection object.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#project\n */\n project(value: Object): Cursor<T>\n\n /**\n * The read() method pulls some data out of the internal buffer and returns it.\n * If there is no data available, then it will return null.\n * @param size Optional argument to specify how much data to read.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#read\n */\n read(size: number): string | Buffer | void\n\n /**\n * Set the cursor returnKey.\n * @param returnKey Only return the index field or fields for the results of the query. If $returnKey is set\n * to true and the query does not use an index to perform the read operation,\n * the returned documents will not contain any fields. Use one of the following forms:\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#next\n */\n returnKey(returnKey: Object): Cursor<T>\n\n /**\n * Resets the cursor.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#rewind\n */\n rewind(): void\n\n /**\n * Set a node.js specific cursor option.\n * @param field The cursor option to set ['numberOfRetries', 'tailableRetryInterval'].\n * @param value The field value.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#setCursorOption\n */\n setCursorOption(field: string, value: Object): Cursor<T>\n\n /**\n * Set the ReadPreference for the cursor.\n * @param readPreference The new read preference for the cursor.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#setReadPreference\n */\n setReadPreference(readPreference: string | ReadPreference): Cursor<T>\n\n /**\n * Set the cursor showRecordId.\n * @param showRecordId The $showDiskLoc option has now been deprecated and replaced with the\n * showRecordId field. $showDiskLoc will still be accepted for OP_QUERY stye find.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#showRecordId\n */\n showRecordId(showRecordId: Object): Cursor<T>\n\n /**\n * Set the skip for the cursor.\n * @param value The skip for the cursor query.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#skip\n */\n skip(value: number): Cursor<T>\n\n /**\n * Set the cursor snapshot.\n * @param snapshot The $snapshot operator prevents the cursor from returning a document more than\n * once because an intervening write operation results in a move of the document.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#snapshot\n */\n snapshot(snapshot: Object): Cursor<T>\n\n /**\n * Sets the sort order of the cursor query.\n * @param keyOrList The key or keys set for the sort.\n * @param direction The direction of the sorting (1 or -1).\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#sort\n */\n sort(keyOrList: string | Object[] | Object, direction?: number): Cursor<T>\n\n /**\n * Return a modified Readable stream including a possible transform method.\n * @param options Optional settings.\n * @param transform A transformation method applied to each document emitted by the stream.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#stream\n */\n stream(options?: { transform?: Function }): Cursor<T>\n\n /**\n * Returns an array of documents. The caller is responsible for making sure that there is enough\n * memory to store the results. Note that the array only contain partial results when this cursor had\n * been previously accessed. In that case, cursor.rewind() can be used to reset the cursor.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#toArray\n */\n toArray(): Promise<T[]>\n\n /**\n * Returns an array of documents. The caller is responsible for making sure that there is enough\n * memory to store the results. Note that the array only contain partial results when this cursor had\n * been previously accessed. In that case, cursor.rewind() can be used to reset the cursor.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#toArray\n */\n toArray(callback: MongoCallback<T[]>): void\n\n /**\n * This is useful in certain cases where a stream is being consumed by a parser, which needs to \"un-consume\" some\n * data that it has optimistically pulled out of the source, so that the stream can be passed on to some other party.\n * @param stream Chunk of data to unshift onto the read queue.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#unshift\n */\n unshift(stream: Buffer | string): void\n}\n\n/**\n * Get the count of documents for this cursor.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#count\n */\nexport interface CursorCommentOptions {\n /**\n * The number of documents to skip.\n */\n skip?: number\n\n /**\n * The maximum amounts to count before aborting.\n */\n limit?: number\n\n /**\n * Number of miliseconds to wait before aborting the query.\n */\n maxTimeMS?: number\n\n /**\n * An index name hint for the query.\n */\n hint?: string\n\n /**\n * The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED,\n * ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).\n */\n readPreference?: ReadPreference | string\n}\n\n/**\n * Creates a new Change Stream instance.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/ChangeStream.html\n */\nexport declare class ChangeStream extends Readable {\n constructor(\n changeDomain: MongoClient | Db | Collection<any>,\n pipeline: Object[],\n options?: ChangeStreamOptions,\n )\n\n /**\n * Close the Change Stream.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/ChangeStream.html#close\n */\n close(): Promise<any>\n\n /**\n * Close the Change Stream.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/ChangeStream.html#close\n */\n close(callback: MongoCallback<any>): void\n\n /**\n * Check if there is any document still available in the Change Stream.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/ChangeStream.html#hasNext\n */\n hasNext(): Promise<any>\n\n /**\n * Check if there is any document still available in the Change Stream.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/ChangeStream.html#hasNext\n */\n hasNext(callback: MongoCallback<any>): void\n\n /**\n * Is the cursor closed.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/ChangeStream.html#isClosed\n */\n isClosed(): boolean\n\n /**\n * Get the next available document from the Change Stream, returns null if no more documents are available.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/ChangeStream.html#next\n */\n next(): Promise<any>\n\n /**\n * Get the next available document from the Change Stream, returns null if no more documents are available.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/ChangeStream.html#next\n */\n next(callback: MongoCallback<any>): void\n\n /**\n * Return a modified Readable stream including a possible transform method.\n * @param options Optional settings.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/ChangeStream.html#stream\n */\n stream(options?: { transform: Function }): Cursor<any>\n}\n\n/**\n * ChangeStreamOptions\n */\nexport interface ChangeStreamOptions {\n /**\n * Allowed values: ‘default’, ‘updateLookup’.\n * When set to ‘updateLookup’, the change stream will include both a delta describing the changes to the document,\n * as well as a copy of the entire document that was changed from some time after the change occurred.\n */\n fullDocument?: string\n\n /**\n * The maximum amount of time for the server to wait on new documents to satisfy a change stream query\n */\n maxAwaitTimeMS?: number\n\n /**\n * Specifies the logical starting point for the new change stream.\n * This should be the _id field from a previously returned change stream document.\n */\n resumeAfter?: Object\n\n /**\n * The number of documents to return per batch.\n */\n batchSize?: number\n\n /**\n * Specify collation settings for operation.\n */\n collation?: CollationDocument\n\n /**\n * The read preference. Defaults to the read preference of the database or collection.\n */\n readPreference?: ReadPreference\n}\n\n/**\n * CollationDocument\n */\nexport interface CollationDocument {\n locale: string\n strength?: number\n caseLevel?: boolean\n caseFirst?: string\n numericOrdering?: boolean\n alternate?: string\n maxVariable?: string\n backwards?: boolean\n normalization?: boolean\n}\n\n/**\n * A class representing a client session on the server.\n * WARNING: not meant to be instantiated directly.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/ClientSession.html\n */\nexport interface ClientSession extends EventEmitter {\n /**\n * The server id associated with this session\n */\n id: any\n\n /**\n * Aborts the currently active transaction in this session.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/ClientSession.html#abortTransaction\n */\n abortTransaction(): Promise<void>\n\n /**\n * Aborts the currently active transaction in this session.\n * @param callback Optional callback for completion of this operation\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/ClientSession.html#abortTransaction\n */\n abortTransaction(callback?: MongoCallback<void>): Promise<void>\n\n /**\n * Advances the operationTime for a ClientSession.\n * @param operationTime the BSON.Timestamp of the operation type it is desired to advance to.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/ClientSession.html#advanceOperationTime\n */\n advanceOperationTime(operationTime: Timestamp): void\n\n /**\n * Commits the currently active transaction in this session.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/ClientSession.html#commitTransaction\n */\n commitTransaction(): Promise<void>\n\n /**\n * Commits the currently active transaction in this session.\n * @param callback Optional callback for completion of this operation.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/ClientSession.html#commitTransaction\n */\n commitTransaction(callback?: MongoCallback<void>): Promise<void>\n\n /**\n * Ends this session on the server.\n * @param callback Optional callback for completion of this operation.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/ClientSession.html#endSession\n */\n endSession(callback?: MongoCallback<void>): void\n\n /**\n * Ends this session on the server.\n * @param options Optional settings. Currently reserved for future use.\n * @param callback Optional callback for completion of this operation.\n * @see @see http://mongodb.github.io/node-mongodb-native/3.1/api/ClientSession.html#endSession\n */\n endSession(options?: any, callback?: MongoCallback<void>): void\n\n /**\n * Used to determine if this session equals another.\n * @param session A class representing a client session on the server.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/ClientSession.html#equals\n */\n equals(session: ClientSession): boolean\n\n /**\n * Increment the transaction number on the internal ServerSession.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/ClientSession.html#incrementTransactionNumber\n */\n incrementTransactionNumber(): void\n\n /**\n * Check this session is currently in a transaction or not.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/ClientSession.html#inTransaction\n */\n inTransaction(): boolean\n\n /**\n * Starts a new transaction with the given options.\n * @param options Optional settings.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/ClientSession.html#startTransaction\n */\n startTransaction(options?: TransactionOptions): void\n}\n\n/**\n * Options to pass when creating a Client Session\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/global.html#SessionOptions\n */\nexport interface SessionOptions {\n /**\n * Whether causal consistency should be enabled on this session\n */\n causalConsistency?: boolean\n\n /**\n * The default TransactionOptions to use for transactions started on this session.\n */\n defaultTransactionOptions?: TransactionOptions\n}\n\n/**\n * TransactionOptions\n */\nexport interface TransactionOptions {\n readConcern?: ReadConcern\n writeConcern?: WriteConcern\n readPreference?: ReadPreference\n}\n\n/**\n * MongoClientCommonOption\n */\nexport interface MongoClientCommonOption {\n /**\n * Do not make the db an event listener to the original connection.\n */\n noListener?: boolean\n\n /**\n * Control if you want to return a cached instance or have a new one created\n */\n returnNonCachedInstance?: boolean\n}\n\n/**\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/global.html#ReadConcern\n */\nexport type ReadConcernLevel =\n | \"local\"\n | \"available\"\n | \"majority\"\n | \"linearizable\"\n | \"snapshot\"\n\n/**\n * The MongoDB ReadConcern, which allows for control of the consistency and isolation properties\n * of the data read from replica sets and replica set shards.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/global.html#ReadConcern\n */\nexport interface ReadConcern {\n level?: ReadConcernLevel\n}\n\n/**\n * A MongoDB WriteConcern, which describes the level of acknowledgement\n * requested from MongoDB for write operations.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/global.html#WriteConcern\n */\nexport interface WriteConcern {\n /**\n * requests acknowledgement that the write operation has\n * propagated to a specified number of mongod hosts\n */\n w?: number | \"majority\" | string\n\n /**\n * requests acknowledgement from MongoDB that the write operation has\n * been written to the journal\n */\n j?: boolean\n\n /**\n * a time limit, in milliseconds, for the write concern\n */\n wtimeout?: number\n}\n\n/**\n * The callback format for the forEach iterator method.\n * @param doc An emitted document for the iterator.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#~iteratorCallback\n */\nexport interface IteratorCallback<T> {\n (doc: T): void\n}\n\n/**\n * The callback error format for the forEach iterator method.\n * @param error An error instance representing the error during the execution.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#~endCallback\n */\nexport interface EndCallback {\n (error: MongoError): void\n}\n\n/**\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#~resultCallback\n */\nexport type AggregationCursorResult = any | void\n\n/**\n * Creates a new Aggregation Cursor instance (INTERNAL TYPE, do not instantiate directly),\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html\n */\nexport interface AggregationCursor<T> extends Readable {\n /**\n * Set the batch size for the cursor.\n * @param value The batchSize for the cursor.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#batchSize\n */\n batchSize(value: number): AggregationCursor<T>\n\n /**\n * Clone the cursor.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#clone\n */\n clone(): AggregationCursor<T>\n\n /**\n * Close the cursor, sending a AggregationCursor command and emitting close.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#close\n */\n close(): Promise<AggregationCursorResult>\n\n /**\n * Close the cursor, sending a AggregationCursor command and emitting close.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#close\n */\n close(callback: MongoCallback<AggregationCursorResult>): void\n\n /**\n * Iterates over all the documents for this cursor. As with {cursor.toArray}, not all of the elements will\n * be iterated if this cursor had been previouly accessed. In that case, {cursor.rewind} can be used to reset\n * the cursor. However, unlike {cursor.toArray}, the cursor will only hold a maximum of batch size elements\n * at any given time if batch size is specified. Otherwise, the caller is responsible for making sure\n * that the entire result can fit the memory.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#each\n */\n each(callback: MongoCallback<AggregationCursorResult>): void\n\n /**\n * Execute the explain for the cursor.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#explain\n */\n explain(): Promise<AggregationCursorResult>\n\n /**\n * Execute the explain for the cursor.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#explain\n */\n explain(callback: MongoCallback<AggregationCursorResult>): void\n\n /**\n * Add a geoNear stage to the aggregation pipeline.\n * @param document The geoNear stage document.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#geoNear\n */\n geoNear(document: Object): AggregationCursor<T>\n\n /**\n * Add a group stage to the aggregation pipeline.\n * @param document The group stage document.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#group\n */\n group(document: Object): AggregationCursor<T>\n\n /**\n * Is the cursor closed.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#isClosed\n */\n isClosed(): boolean\n\n /**\n * Add a limit stage to the aggregation pipeline.\n * @param value The state limit value.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#limit\n */\n limit(value: number): AggregationCursor<T>\n\n /**\n * Add a match stage to the aggregation pipeline.\n * @param document The match stage document.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#match\n */\n match(document: Object): AggregationCursor<T>\n\n /**\n * Add a maxTimeMS stage to the aggregation pipeline.\n * @param value The state maxTimeMS value.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#maxTimeMS\n */\n maxTimeMS(value: number): AggregationCursor<T>\n\n /**\n * Get the next available document from the cursor, returns null if no more documents are available.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#next\n */\n next(): Promise<AggregationCursorResult>\n\n /**\n * Get the next available document from the cursor, returns null if no more documents are available.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#next\n */\n next(callback: MongoCallback<AggregationCursorResult>): void\n\n /**\n * Add a out stage to the aggregation pipeline.\n * @param destination The destination name.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#out\n */\n out(destination: string): AggregationCursor<T>\n\n /**\n * Add a project stage to the aggregation pipeline.\n * @param document The project stage document.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#project\n */\n project(document: Object): AggregationCursor<T>\n\n /**\n * The read() method pulls some data out of the internal buffer and returns it.\n * If there is no data available, then it will return null.\n * @param size Optional argument to specify how much data to read.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#read\n */\n read(size: number): string | Buffer | void\n\n /**\n * Add a redact stage to the aggregation pipeline.\n * @param document The redact stage document.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#redact\n */\n redact(document: Object): AggregationCursor<T>\n\n /**\n * Resets the cursor.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#rewind\n */\n rewind(): AggregationCursor<T>\n\n /**\n * Add a skip stage to the aggregation pipeline.\n * @param value The state skip value.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#setEncoding\n */\n skip(value: number): AggregationCursor<T>\n\n /**\n * Add a sort stage to the aggregation pipeline.\n * @param document The sort stage document.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#sort\n */\n sort(document: Object): AggregationCursor<T>\n\n /**\n * Returns an array of documents. The caller is responsible for making sure that there\n * is enough memory to store the results. Note that the array only contain partial\n * results when this cursor had been previouly accessed. In that case,\n * cursor.rewind() can be used to reset the cursor.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#toArray\n */\n toArray(): Promise<T[]>\n\n /**\n * Returns an array of documents. The caller is responsible for making sure that there\n * is enough memory to store the results. Note that the array only contain partial\n * results when this cursor had been previouly accessed. In that case,\n * cursor.rewind() can be used to reset the cursor.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#toArray\n */\n toArray(callback: MongoCallback<T[]>): void\n\n /**\n * This is useful in certain cases where a stream is being consumed by a parser,\n * which needs to \"un-consume\" some data that it has optimistically pulled out of the source,\n * so that the stream can be passed on to some other party.\n * @param stream Chunk of data to unshift onto the read queue.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#unshift\n */\n unshift(stream: Buffer | string): void\n\n /**\n * Add a unwind stage to the aggregation pipeline.\n * @param field The unwind field name.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#unwind\n */\n unwind(field: string): AggregationCursor<T>\n}\n\n/**\n * CommandCursor.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html\n */\nexport interface CommandCursor extends Readable {\n /**\n * Set the batch size for the cursor.\n * @param value The batchSize for the cursor.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#batchSize\n */\n batchSize(value: number): CommandCursor\n\n /**\n * Clone the cursor.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#clone\n */\n clone(): CommandCursor\n\n /**\n * Close the cursor, sending a KillCursor command and emitting close.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#close\n */\n close(): Promise<AggregationCursorResult>\n\n /**\n * Close the cursor, sending a KillCursor command and emitting close.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#close\n */\n close(callback: MongoCallback<AggregationCursorResult>): void\n\n /**\n * Each\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#each\n */\n each(callback: MongoCallback<AggregationCursorResult>): void\n\n /**\n * Is the cursor closed.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#isClosed\n */\n isClosed(): boolean\n\n /**\n * Add a maxTimeMS stage to the aggregation pipeline.\n * @param value The state maxTimeMS value.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#maxTimeMS\n */\n maxTimeMS(value: number): CommandCursor\n\n /**\n * Get the next available document from the cursor, returns null if no more documents are available.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#next\n */\n next(): Promise<AggregationCursorResult>\n\n /**\n * Get the next available document from the cursor, returns null if no more documents are available.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#next\n */\n next(callback: MongoCallback<AggregationCursorResult>): void\n\n /**\n * The read() method pulls some data out of the internal buffer and returns it.\n * If there is no data available, then it will return null.\n * @param size Optional argument to specify how much data to read.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#read\n */\n read(size: number): string | Buffer | void\n\n /**\n * Resets the cursor.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#rewind\n */\n rewind(): CommandCursor\n\n /**\n * Set the ReadPreference for the cursor.\n * @param readPreference The new read preference for the cursor.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#setReadPreference\n */\n setReadPreference(readPreference: string | ReadPreference): CommandCursor\n\n /**\n * Returns an array of documents. The caller is responsible for making sure that there is enough memory\n * to store the results. Note that the array only contain partial results when this cursor had been previouly accessed.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#toArray\n */\n toArray(): Promise<any[]>\n\n /**\n * Returns an array of documents. The caller is responsible for making sure that there is enough memory\n * to store the results. Note that the array only contain partial results when this cursor had been previouly accessed.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#toArray\n */\n toArray(callback: MongoCallback<any[]>): void\n\n /**\n * This is useful in certain cases where a stream is being consumed by a parser,\n * which needs to \"un-consume\" some data that it has optimistically pulled out of the source,\n * so that the stream can be passed on to some other party.\n * @param stream Chunk of data to unshift onto the read queue.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#unshift\n */\n unshift(stream: Buffer | string): void\n}\n\n/**\n * GridFSBucket.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucket.html\n */\nexport declare class GridFSBucket {\n /**\n *\n * @param db A db handle.\n * @param options Optional settings.\n */\n constructor(db: Db, options?: GridFSBucketOptions)\n\n /**\n * Deletes a file with the given id.\n * @param id The id of the file doc\n * @param callback The result callback\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucket.html#delete\n */\n delete(id: ObjectID, callback?: GridFSBucketErrorCallback): void\n\n /**\n * Removes this bucket's files collection, followed by its chunks collection.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucket.html#drop\n */\n drop(callback?: GridFSBucketErrorCallback): void\n\n /**\n * Convenience wrapper around find on the files collection\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucket.html#find\n */\n find(filter?: Object, options?: GridFSBucketFindOptions): Cursor<any>\n\n /**\n * Returns a readable stream (GridFSBucketReadStream) for streaming file.\n * @param id The id of the file doc.\n * @param options Optional settings\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucket.html#openDownloadStream\n */\n openDownloadStream(\n id: ObjectID,\n options?: { start: number; end: number },\n ): GridFSBucketReadStream\n\n /**\n * Returns a readable stream (GridFSBucketReadStream) for streaming file\n * @param filename The id of the file doc\n * @param options Optional settings\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucket.html#openDownloadStreamByName\n */\n\n openDownloadStreamByName(\n filename: string,\n options?: { revision: number; start: number; end: number },\n ): GridFSBucketReadStream\n\n /**\n * Returns a writable stream (GridFSBucketWriteStream) for writing buffers to GridFS.\n * The stream's 'id' property contains the resulting file's id.\n * @param filename The value of the 'filename' key in the files doc.\n * @param options Optional settings\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucket.html#openUploadStream\n */\n openUploadStream(\n filename: string,\n options?: GridFSBucketOpenUploadStreamOptions,\n ): GridFSBucketWriteStream\n\n /**\n * Returns a writable stream (GridFSBucketWriteStream) for writing buffers to GridFS for a custom file id.\n * The stream's 'id' property contains the resulting file's id.\n * @param id A custom id used to identify the file.\n * @param filename The value of the 'filename' key in the files doc.\n * @param options Optional settings\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucket.html#openUploadStreamWithId\n */\n openUploadStreamWithId(\n id: string | number | Object,\n filename: string,\n options?: GridFSBucketOpenUploadStreamOptions,\n ): GridFSBucketWriteStream\n\n /**\n * Renames the file with the given _id to the given string.\n * @param id the id of the file to rename.\n * @param filename new name for the file.\n * @param callback The result callback\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucket.html#rename\n */\n rename(\n id: ObjectID,\n filename: string,\n callback?: GridFSBucketErrorCallback,\n ): void\n}\n\n/**\n * Constructor for a streaming GridFS interface.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucket.html\n */\nexport interface GridFSBucketOptions {\n /**\n * The 'files' and 'chunks' collections will be prefixed with the bucket name followed by a dot.\n */\n bucketName?: string\n\n /**\n * Number of bytes stored in each chunk. Defaults to 255KB.\n */\n chunkSizeBytes?: number\n\n /**\n * Optional write concern to be passed to write operations, for instance { w: 1 }.\n */\n writeConcern?: WriteConcern\n\n /**\n * Optional read preference to be passed to read operations.\n */\n ReadPreference?: ReadPreference\n}\n\n/**\n * GridFSBucketErrorCallback.\n * @param err An error instance representing any errors that occurred.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucket.html#~errorCallback\n */\nexport interface GridFSBucketErrorCallback {\n (err?: MongoError): void\n}\n\n/**\n * GridFSBucketFindOptions.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucket.html#find\n */\nexport interface GridFSBucketFindOptions {\n /**\n * Optional batch size for cursor.\n */\n batchSize?: number\n\n /**\n * Optional limit for cursor.\n */\n limit?: number\n\n /**\n * Optional maxTimeMS for cursor.\n */\n maxTimeMS?: number\n\n /**\n * Optionally set cursor's noCursorTimeout flag.\n */\n noCursorTimeout?: boolean\n\n /**\n * Optional skip for cursor.\n */\n skip?: number\n\n /**\n * Optional sort for cursor.\n */\n sort?: Object\n}\n\n/**\n * GridFSBucketOpenUploadStreamOptions.\n * @see https://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucket.html#openUploadStream\n */\nexport interface GridFSBucketOpenUploadStreamOptions {\n /**\n * Optional overwrite this bucket's chunkSizeBytes for this file.\n */\n chunkSizeBytes?: number\n\n /**\n * Optional object to store in the file document's metadata field.\n */\n metadata?: Object\n\n /**\n * Optional string to store in the file document's contentType field.\n */\n contentType?: string\n\n /**\n * Optional array of strings to store in the file document's aliases field.\n */\n aliases?: Array<string>\n}\n\n/**\n * GridFSBucketReadStream.\n * @see https://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucketReadStream.html\n */\nexport declare class GridFSBucketReadStream extends Readable {\n /**\n *\n * @param chunks Handle for chunks collection.\n * @param files Handle for files collection.\n * @param readPreference The read preference to use.\n * @param filter The query to use to find the file document.\n * @param options Optional settings.\n */\n constructor(\n chunks: Collection<any>,\n files: Collection<any>,\n readPreference: Object,\n filter: Object,\n options?: GridFSBucketReadStreamOptions,\n )\n}\n\n/**\n * GridFSBucketReadStreamOptions.\n * @see https://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucketReadStream.html\n */\nexport interface GridFSBucketReadStreamOptions {\n /**\n * Optional sort for the file find query.\n */\n sort?: number\n\n /**\n * Optional skip for the file find query.\n */\n skip?: number\n\n /**\n * Optional 0-based offset in bytes to start streaming from.\n */\n start?: number\n\n /**\n * Optional 0-based offset in bytes to stop streaming before.\n */\n end?: number\n}\n\n/**\n * GridFSBucketWriteStream\n * @see https://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucketWriteStream.html\n */\nexport declare class GridFSBucketWriteStream extends Writable {\n /**\n *\n * @param bucket Handle for this stream's corresponding bucket.\n * @param filename The value of the 'filename' key in the files doc.\n * @param options Optional settings.\n */\n constructor(\n bucket: GridFSBucket,\n filename: string,\n options?: GridFSBucketWriteStreamOptions,\n )\n}\n\n/**\n * GridFSBucketWriteStreamOptions.\n * @see https://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucketWriteStream.html\n */\nexport interface GridFSBucketWriteStreamOptions {\n /**\n * Custom file id for the GridFS file.\n */\n id?: string | number | Object\n\n /**\n * The chunk size to use, in bytes.\n */\n chunkSizeBytes?: number\n\n /**\n * The write concern.\n */\n w?: number\n\n /**\n * The write concern timeout.\n */\n wtimeout?: number\n\n /**\n * The journal write concern.\n */\n j?: number\n}\n"],"sourceRoot":"../.."}
1
+ {"version":3,"sources":["../browser/src/driver/mongodb/typings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA","file":"typings.js","sourcesContent":["import { EventEmitter, Readable, Writable } from \"../../platform/PlatformTools\"\n\n/**\n * Creates a new MongoClient instance.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/MongoClient.html\n */\nexport declare class MongoClient extends EventEmitter {\n constructor(uri: string, options?: MongoClientOptions)\n\n /**\n * Connect to MongoDB using a url as documented at docs.mongodb.org/manual/reference/connection-string/\n * Note that for replicasets the replicaSet query parameter is required in the 2.0 driver.\n *\n * @param url The connection URI string.\n * @param callback The command result callback.\n */\n static connect(url: string, callback: MongoCallback<Db>): void\n\n /**\n * Connect to MongoDB using a url as documented at docs.mongodb.org/manual/reference/connection-string/\n * Note that for replicasets the replicaSet query parameter is required in the 2.0 driver.\n *\n * @param url The connection URI string.\n * @param options Optional settings.\n */\n static connect(url: string, options?: MongoClientOptions): Promise<Db>\n\n /**\n * Connect to MongoDB using a url as documented at docs.mongodb.org/manual/reference/connection-string/\n * Note that for replicasets the replicaSet query parameter is required in the 2.0 driver.\n *\n * @param url The connection URI string.\n * @param options Optional settings.\n * @param callback The command result callback.\n */\n static connect(\n url: string,\n options: MongoClientOptions,\n callback: MongoCallback<Db>,\n ): void\n\n /**\n * Connect to MongoDB using a url as documented at docs.mongodb.org/manual/reference/connection-string/\n * Note that for replicasets the replicaSet query parameter is required in the 2.0 driver.\n */\n connect(): Promise<MongoClient>\n\n /**\n * Connect to MongoDB using a url as documented at docs.mongodb.org/manual/reference/connection-string/\n * Note that for replicasets the replicaSet query parameter is required in the 2.0 driver.\n *\n * @param url The connection URI string.\n * @param callback The command result callback.\n */\n connect(url: string, callback: MongoCallback<Db>): void\n\n /**\n * Connect to MongoDB using a url as documented at docs.mongodb.org/manual/reference/connection-string/\n * Note that for replicasets the replicaSet query parameter is required in the 2.0 driver.\n *\n * @param url The connection URI string.\n * @param options Optional settings.\n */\n connect(url: string, options?: MongoClientOptions): Promise<Db>\n\n /**\n * Connect to MongoDB using a url as documented at docs.mongodb.org/manual/reference/connection-string/\n * Note that for replicasets the replicaSet query parameter is required in the 2.0 driver.\n *\n * @param url The connection URI string.\n * @param options Optional settings.\n * @param callback The command result callback.\n */\n connect(\n url: string,\n options: MongoClientOptions,\n callback: MongoCallback<Db>,\n ): void\n\n /**\n * Close the db and its underlying connections.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/MongoClient.html#close\n */\n close(callback: MongoCallback<void>): void\n\n /**\n * Close the db and its underlying connections.\n * @param force Force close, emitting no events.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/MongoClient.html#close\n */\n close(force?: boolean): Promise<void>\n\n /**\n * Close the db and its underlying connections.\n * @param force Force close, emitting no events.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/MongoClient.html#close\n */\n close(force: boolean, callback: MongoCallback<void>): void\n\n /**\n * Create a new Db instance sharing the current socket connections. Be aware that the new db instances are\n * related in a parent-child relationship to the original instance so that events are correctly emitted on child\n * db instances. Child db instances are cached so performing db('db1') twice will return the same instance.\n * You can control these behaviors with the options noListener and returnNonCachedInstance.\n * @param dbName The name of the database we want to use. If not provided, use database name from connection string.\n * @param options Optional settings.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/MongoClient.html#db\n */\n db(dbName?: string, options?: MongoClientCommonOption): Db\n\n /**\n * Check if MongoClient is connected.\n * @param options Optional settings.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/MongoClient.html#isConnected\n */\n isConnected(options?: MongoClientCommonOption): boolean\n\n /**\n * Logout user from server, fire off on all connections and remove all auth info.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/MongoClient.html#logout\n */\n logout(callback: MongoCallback<any>): void\n logout(options?: { dbName?: string }): Promise<any>\n logout(options: { dbName?: string }, callback: MongoCallback<any>): void\n\n /**\n * Starts a new session on the server.\n * @param options Optional settings.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/MongoClient.html#startSession\n */\n startSession(options?: SessionOptions): ClientSession\n\n /**\n * Create a new Change Stream, watching for new changes (insertions, updates, replacements, deletions, and invalidations) in this cluster.\n * Will ignore all changes to system collections, as well as the local, admin, and config databases.\n * @param pipeline An array of aggregation pipeline stages through which to pass change stream documents. This allows for filtering (using $match) and manipulating the change stream documents.\n * @param options Optional settings.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#watch\n */\n watch(\n pipeline?: Object[],\n options?: ChangeStreamOptions & {\n startAtClusterTime?: Timestamp\n session?: ClientSession\n },\n ): ChangeStream\n\n /**\n * Runs a given operation with an implicitly created session. The lifetime of the session will be handled without the need for user interaction.\n * @param operation An operation to execute with an implicitly created session. The signature of this MUST be `(session) => {}`\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/MongoClient.html#withSession\n */\n withSession(\n operation: (session: ClientSession) => Promise<any>,\n ): Promise<void>\n\n /**\n * Runs a given operation with an implicitly created session. The lifetime of the session will be handled without the need for user interaction.\n * @param options Optional settings to be appled to implicitly created session.\n * @param operation An operation to execute with an implicitly created session. The signature of this MUST be `(session) => {}`\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/MongoClient.html#withSession\n */\n withSession(\n options: SessionOptions,\n operation: (session: ClientSession) => Promise<any>,\n ): Promise<void>\n}\n\n/**\n * The callback format for results.\n */\nexport interface MongoCallback<T> {\n /**\n * @param error An error instance representing the error during the execution.\n * @param result The result of execution.\n */\n (error: MongoError, result: T): void\n}\n\n// http://mongodb.github.io/node-mongodb-native/2.1/api/MongoError.html\nexport declare class MongoError extends Error {\n constructor(message: string)\n static create(options: Object): MongoError\n}\n\n/**\n * Options for MongoClient#connect method.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.2/api/MongoClient.html#.connect\n */\nexport interface MongoClientOptions {\n /**\n * The maximum size of the individual server pool.\n */\n poolSize?: number\n\n /**\n * Enable SSL connection.\n */\n ssl?: boolean\n\n /**\n * SSL Certificate store binary buffer.\n */\n sslCA?: Buffer\n\n /**\n * Uri decode the user name and password for authentication.\n */\n uri_decode_auth?: boolean\n\n /**\n * A hash of options to set on the db object, see Db constructor.\n */\n db?: DbCreateOptions\n\n /**\n * A hash of options to set on the server objects, see Server constructor**.\n */\n server?: ServerOptions\n\n /**\n * A hash of options to set on the replSet object, see ReplSet constructor**.\n */\n replSet?: ReplSetOptions\n\n /**\n * A hash of options to set on the mongos object, see Mongos constructor**.\n */\n mongos?: MongosOptions\n\n /**\n * A Promise library class the application wishes to use such as Bluebird, must be ES6 compatible.\n */\n promiseLibrary?: Object\n}\n\nexport interface CommandOptions {\n /**\n * The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED,\n * ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).\n */\n readPreference?: ReadPreference | string\n\n /**\n * Number of milliseconds to wait before aborting the query.\n */\n maxTimeMS?: number\n}\n\n/**\n * Options for Db class.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html\n */\nexport interface DbCreateOptions {\n /**\n * If the database authentication is dependent on another databaseName.\n */\n authSource?: string\n\n /**\n * The write concern.\n */\n w?: number | string\n\n /**\n * The write concern timeout.\n */\n wtimeout?: number\n\n /**\n * Specify a journal write concern.\n */\n j?: boolean\n\n /**\n * The current value of the parameter native_parser.\n */\n native_parser?: boolean\n\n /**\n * Force server to assign _id values instead of driver.\n */\n forceServerObjectId?: boolean\n\n /**\n * Serialize functions on any object.\n */\n serializeFunctions?: boolean\n\n /**\n * Specify if the BSON serializer should ignore undefined fields.\n */\n ignoreUndefined?: boolean\n\n /**\n * Return document results as raw BSON buffers.\n */\n raw?: boolean\n\n /**\n * Promotes Long values to number if they fit inside the 53 bits resolution.\n */\n promoteLongs?: boolean\n\n /**\n * Sets a cap on how many operations the driver will buffer up before giving up on getting a working connection, default is -1 which is unlimited.\n */\n bufferMaxEntries?: number\n\n /**\n * The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).\n */\n readPreference?: ReadPreference | string\n\n /**\n * A primary key factory object for generation of custom _id keys.\n */\n pkFactory?: Object\n\n /**\n * A Promise library class the application wishes to use such as Bluebird, must be ES6 compatible.\n */\n promiseLibrary?: Object\n\n /**\n * Specify a read concern for the collection. (only MongoDB 3.2 or higher supported).\n */\n readConcern?: ReadConcern\n}\n\n/**\n * Creates a new ReadPreference instance.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/ReadPreference.html\n */\nexport declare class ReadPreference {\n constructor(mode: string, tags: Object)\n\n /**\n * The ReadPreference mode as listed above.\n */\n mode: string\n\n /**\n * An object representing read preference tags.\n */\n tags: any\n\n /**\n * Read from primary only. All operations produce an error (throw an exception where applicable) if primary is unavailable. Cannot be combined with tags (This is the default.).\n */\n static PRIMARY: string\n\n /**\n * Read from primary if available, otherwise a secondary.\n */\n static PRIMARY_PREFERRED: string\n\n /**\n * Read from secondary if available, otherwise error.\n */\n static SECONDARY: string\n\n /**\n * Read from a secondary if available, otherwise read from the primary.\n */\n static SECONDARY_PREFERRED: string\n\n /**\n * All modes read from among the nearest candidates, but unlike other modes, NEAREST will include both the primary and all secondaries in the random selection.\n */\n static NEAREST: string\n\n /**\n * Validate if a mode is legal.\n */\n isValid(mode: string): boolean\n\n /**\n * Validate if a mode is legal.\n */\n static isValid(mode: string): boolean\n}\n\n/**\n * Creates a new Server instance.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Server.html\n */\nexport interface SocketOptions {\n /**\n * Reconnect on error.\n */\n autoReconnect?: boolean\n\n /**\n * TCP Socket NoDelay option.\n */\n noDelay?: boolean\n\n /**\n * TCP KeepAlive on the socket with a X ms delay before start.\n */\n keepAlive?: number\n\n /**\n * TCP Connection timeout setting.\n */\n connectTimeoutMS?: number\n\n /**\n * TCP Socket timeout setting.\n */\n socketTimeoutMS?: number\n}\n\n/**\n * Creates a new Server instance.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Server.html\n */\nexport interface ServerOptions {\n /**\n * Number of connections in the connection pool for each server instance, set to 5 as default for legacy reasons.\n */\n poolSize?: number\n\n /**\n * Use ssl connection (needs to have a mongod server with ssl support).\n */\n ssl?: boolean\n\n /**\n * Validate mongod server certificate against ca (needs to have a mongod server with ssl support, 2.4 or higher).\n */\n sslValidate?: Object\n\n /**\n * Ensure we check server identify during SSL, set to false to disable checking. Only works for Node 0.12.x or higher. You can pass in a boolean or your own checkServerIdentity override function.\n */\n checkServerIdentity?: boolean | Function\n\n /**\n * Array of valid certificates either as Buffers or Strings (needs to have a mongod server with ssl support, 2.4 or higher).\n */\n sslCA?: Array<Buffer | string>\n\n /**\n * String or buffer containing the certificate we wish to present (needs to have a mongod server with ssl support, 2.4 or higher).\n */\n sslCert?: Buffer | string\n\n /**\n * String or buffer containing the certificate private key we wish to present (needs to have a mongod server with ssl support, 2.4 or higher).\n */\n sslKey?: Buffer | string\n\n /**\n * String or buffer containing the certificate password (needs to have a mongod server with ssl support, 2.4 or higher).\n */\n sslPass?: Buffer | string\n\n /**\n * Socket options.\n */\n socketOptions?: SocketOptions\n\n /**\n * Server attempt to reconnect #times.\n */\n reconnectTries?: number\n\n /**\n * Server will wait # milliseconds between retries.\n */\n reconnectInterval?: number\n}\n\n/**\n * Creates a new ReplSet instance.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/ReplSet.html\n */\nexport interface ReplSetOptions {\n /**\n * Turn on high availability monitoring.\n */\n ha?: boolean\n\n /**\n * Time between each replicaset status check.\n */\n haInterval?: number\n\n /**\n * The name of the replicaset to connect to.\n */\n replicaSet?: string\n\n /**\n * Sets the range of servers to pick when using NEAREST (lowest ping ms + the latency fence, ex: range of 1 to (1 + 15) ms).\n */\n secondaryAcceptableLatencyMS?: number\n\n /**\n * Sets if the driver should connect even if no primary is available.\n */\n connectWithNoPrimary?: boolean\n\n /**\n * Number of connections in the connection pool for each server instance, set to 5 as default for legacy reasons.\n */\n poolSize?: number\n\n /**\n * Use ssl connection (needs to have a mongod server with ssl support).\n */\n ssl?: boolean\n\n /**\n * Validate mongod server certificate against ca (needs to have a mongod server with ssl support, 2.4 or higher).\n */\n sslValidate?: Object\n\n /**\n * Ensure we check server identify during SSL, set to false to disable checking. Only works for Node 0.12.x or higher. You can pass in a boolean or your own checkServerIdentity override function.\n */\n checkServerIdentity?: boolean | Function\n\n /**\n * Array of valid certificates either as Buffers or Strings (needs to have a mongod server with ssl support, 2.4 or higher).\n */\n sslCA?: Array<Buffer | string>\n\n /**\n * String or buffer containing the certificate we wish to present (needs to have a mongod server with ssl support, 2.4 or higher).\n */\n sslCert?: Buffer | string\n\n /**\n * String or buffer containing the certificate private key we wish to present (needs to have a mongod server with ssl support, 2.4 or higher).\n */\n sslKey?: Buffer | string\n\n /**\n * String or buffer containing the certificate private key we wish to present (needs to have a mongod server with ssl support, 2.4 or higher).\n */\n sslPass?: Buffer | string\n\n /**\n * Socket options.\n */\n socketOptions?: SocketOptions\n}\n\n/**\n * Creates a new Mongos instance.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Mongos.html\n */\nexport interface MongosOptions {\n /**\n * Turn on high availability monitoring.\n */\n ha?: boolean\n\n /**\n * Time between each replicaset status check.\n */\n haInterval?: number\n\n /**\n * Number of connections in the connection pool for each server instance, set to 5 as default for legacy reasons.\n */\n poolSize?: number\n\n /**\n * Use ssl connection (needs to have a mongod server with ssl support).\n */\n ssl?: boolean\n\n /**\n * Validate mongod server certificate against ca (needs to have a mongod server with ssl support, 2.4 or higher).\n */\n sslValidate?: Object\n\n /**\n * Ensure we check server identify during SSL, set to false to disable checking. Only works for Node 0.12.x or higher. You can pass in a boolean or your own checkServerIdentity override function.\n */\n checkServerIdentity?: boolean | Function\n\n /**\n * Array of valid certificates either as Buffers or Strings (needs to have a mongod server with ssl support, 2.4 or higher).\n */\n sslCA?: Array<Buffer | string>\n\n /**\n * String or buffer containing the certificate we wish to present (needs to have a mongod server with ssl support, 2.4 or higher).\n */\n sslCert?: Buffer | string\n\n /**\n * String or buffer containing the certificate private key we wish to present (needs to have a mongod server with ssl support, 2.4 or higher).\n */\n sslKey?: Buffer | string\n\n /**\n * String or buffer containing the certificate password (needs to have a mongod server with ssl support, 2.4 or higher).\n */\n sslPass?: Buffer | string\n\n /**\n * Socket options.\n */\n socketOptions?: SocketOptions\n}\n\nexport interface DbOptions {\n /**\n * Do not make the db an event listener to the original connection.\n */\n noListener?: boolean\n\n /**\n * Control if you want to return a cached instance or have a new one created.\n */\n returnNonCachedInstance?: boolean\n}\n\nexport interface IndexInformationOptions {\n /**\n * Returns the full raw index information.\n */\n full?: boolean\n\n /**\n * The preferred read preference (ReadPreference.PRIMARY,\n * ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY,\n * ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).\n */\n readPreference?: ReadPreference | string\n}\n\nexport interface ExecuteDbAdminCommandOptions {\n /**\n * The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED,\n * ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).\n */\n readPreference?: ReadPreference | string\n\n // maxTimeMS?: number;\n}\n\nexport interface ListCollectionsOptions {\n /**\n * The batchSize for the returned command cursor or if pre 2.8 the systems batch collection.\n */\n batchSize?: number\n\n /**\n * The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED,\n * ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).\n */\n readPreference?: ReadPreference | string\n}\n\n/**\n * Db.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html\n */\nexport declare class Db extends EventEmitter {\n /**\n *\n * @param databaseName The name of the database this instance represents.\n * @param serverConfig The server topology for the database.\n * @param options Optional.\n */\n constructor(\n databaseName: string,\n serverConfig: Server | ReplSet | Mongos,\n options?: DbCreateOptions,\n )\n\n /**\n * Get the current db topology.\n */\n serverConfig: Server | ReplSet | Mongos\n\n /**\n * Current bufferMaxEntries value for the database.\n */\n bufferMaxEntries: number\n\n /**\n * The name of the database this instance represents.\n */\n databaseName: string\n\n /**\n * The options associated with the db instance.\n */\n options: any\n\n /**\n * The current value of the parameter native_parser.\n */\n native_parser: boolean\n\n /**\n * The current slaveOk value for the db instance.\n */\n slaveOk: boolean\n\n /**\n * The current write concern values.\n */\n writeConcern: WriteConcern\n\n /**\n * Add a user to the database.\n *\n * @param username The username.\n * @param password The password.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#addUser\n */\n addUser(\n username: string,\n password: string,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Add a user to the database.\n *\n * @param username The username.\n * @param password The password.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#addUser\n */\n addUser(\n username: string,\n password: string,\n options?: DbAddUserOptions,\n ): Promise<any>\n\n /**\n * Add a user to the database.\n *\n * @param username The username.\n * @param password The password.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#addUser\n */\n addUser(\n username: string,\n password: string,\n options: DbAddUserOptions,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Return the Admin db instance.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#admin\n */\n admin(): Admin\n\n /**\n * Authenticate a user against the server.\n *\n * @param userName The username.\n * @param password The password.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#authenticate\n */\n authenticate(\n userName: string,\n password: string,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Authenticate a user against the server.\n *\n * @param userName The username.\n * @param password The password.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#authenticate\n */\n authenticate(\n userName: string,\n password: string,\n options?: { authMechanism: string },\n ): Promise<any>\n\n /**\n * Authenticate a user against the server.\n *\n * @param userName The username.\n * @param password The password.\n * @param password\n * @param options\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#authenticate\n */\n authenticate(\n userName: string,\n password: string,\n options: { authMechanism: string },\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Close the db and its underlying connections.\n *\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#close\n */\n close(callback: MongoCallback<void>): void\n\n /**\n * Close the db and its underlying connections.\n *\n * @param forceClose Force close, emitting no events.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#close\n */\n close(forceClose?: boolean): Promise<void>\n\n /**\n * Close the db and its underlying connections.\n *\n * @param forceClose Force close, emitting no events.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#close\n */\n close(forceClose: boolean, callback: MongoCallback<void>): void\n\n /**\n * Fetch a specific collection (containing the actual collection information). If the application does not use strict mode you can\n * can use it without a callback in the following way: var collection = db.collection('mycollection');\n *\n * @param name The collection name we wish to access.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#collection\n */\n collection(name: string): Collection<any>\n\n /**\n * Fetch a specific collection (containing the actual collection information). If the application does not use strict mode you can\n * can use it without a callback in the following way: var collection = db.collection('mycollection');\n *\n * @param name The collection name we wish to access.\n * @param callback The collection result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#collection\n */\n collection(\n name: string,\n callback: MongoCallback<Collection<any>>,\n ): Collection<any>\n\n /**\n * Fetch a specific collection (containing the actual collection information). If the application does not use strict mode you can\n * can use it without a callback in the following way: var collection = db.collection('mycollection');\n *\n * @param name The collection name we wish to access.\n * @param options Optional settings.\n * @param callback The collection result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#collection\n */\n collection(\n name: string,\n options: DbCollectionOptions,\n callback: MongoCallback<Collection<any>>,\n ): Collection<any>\n\n /**\n * Fetch all collections for the current db.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#collections\n */\n collections(): Promise<Collection<any>[]>\n\n /**\n * Fetch all collections for the current db.\n *\n * @param callback The results callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#collections\n */\n collections(callback: MongoCallback<Collection<any>[]>): void\n\n /**\n * Execute a command.\n *\n * @param command The command hash.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#command\n */\n command(command: Object, callback: MongoCallback<any>): void\n\n /**\n * Execute a command.\n *\n * @param command The command hash.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#command\n */\n command(\n command: Object,\n options?: { readPreference: ReadPreference | string },\n ): Promise<any>\n\n /**\n * Execute a command.\n *\n * @param command The command hash.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#command\n */\n command(\n command: Object,\n options: { readPreference: ReadPreference | string },\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Create a new collection on a server with the specified options. Use this to create capped collections.\n *\n * @param name The collection name we wish to access.\n * @param callback The results callback\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#createCollection\n */\n createCollection(\n name: string,\n callback: MongoCallback<Collection<any>>,\n ): void\n\n /**\n * Create a new collection on a server with the specified options. Use this to create capped collections.\n *\n * @param name The collection name we wish to access.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#createCollection\n */\n createCollection(\n name: string,\n options?: CollectionCreateOptions,\n ): Promise<Collection<any>>\n\n /**\n * Create a new collection on a server with the specified options. Use this to create capped collections.\n *\n * @param name The collection name we wish to access.\n * @param options Optional settings.\n * @param callback The results callback\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#createCollection\n */\n createCollection(\n name: string,\n options: CollectionCreateOptions,\n callback: MongoCallback<Collection<any>>,\n ): void\n\n /**\n * Creates an index on the db and collection collection.\n *\n * @param name Name of the collection to create the index on.\n * @param fieldOrSpec Defines the index.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#createIndex\n */\n createIndex(\n name: string,\n fieldOrSpec: string | Object,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Creates an index on the db and collection collection.\n *\n * @param name Name of the collection to create the index on.\n * @param fieldOrSpec Defines the index.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#createIndex\n */\n createIndex(\n name: string,\n fieldOrSpec: string | Object,\n options?: MongodbIndexOptions,\n ): Promise<any>\n\n /**\n * Creates an index on the db and collection collection.\n *\n * @param name Name of the collection to create the index on.\n * @param fieldOrSpec Defines the index.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#createIndex\n */\n createIndex(\n name: string,\n fieldOrSpec: string | Object,\n options: MongodbIndexOptions,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Create a new Db instance sharing the current socket connections. Be aware that the new db instances are\n * related in a parent-child relationship to the original instance so that events are correctly emitted on child\n * db instances. Child db instances are cached so performing db('db1') twice will return the same instance.\n * You can control these behaviors with the options noListener and returnNonCachedInstance.\n *\n * @param dbName The name of the database we want to use.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#db\n */\n db(dbName: string): Db\n\n /**\n * Create a new Db instance sharing the current socket connections. Be aware that the new db instances are\n * related in a parent-child relationship to the original instance so that events are correctly emitted on child\n * db instances. Child db instances are cached so performing db('db1') twice will return the same instance.\n * You can control these behaviors with the options noListener and returnNonCachedInstance.\n *\n * @param dbName The name of the database we want to use.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#db\n */\n db(dbName: string, options: DbOptions): Db\n\n /**\n * Drop a collection from the database, removing it permanently. New accesses will create a new collection.\n *\n * @param name Name of collection to drop.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#dropCollection\n */\n dropCollection(name: string): Promise<boolean>\n\n /**\n * Drop a collection from the database, removing it permanently. New accesses will create a new collection.\n *\n * @param name Name of collection to drop.\n * @param callback The results callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#dropCollection\n */\n dropCollection(name: string, callback: MongoCallback<boolean>): void\n\n /**\n * Drop a database, removing it permanently from the server.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#dropDatabase\n */\n dropDatabase(): Promise<any>\n\n /**\n * Drop a database, removing it permanently from the server.\n *\n * @param callback The results callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#dropDatabase\n */\n dropDatabase(callback: MongoCallback<any>): void\n\n // deprecated http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#ensureIndex\n // ensureIndex(collectionName: any, fieldOrSpec: any, options: IndexOptions, callback: Function): void;\n // deprecated http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#eval\n // eval(code: any, parameters: any[], options?: any, callback?: MongoCallback<any>): void;\n\n /**\n * Runs a command on the database as admin.\n *\n * @param command The command hash.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#executeDbAdminCommand\n */\n executeDbAdminCommand(command: Object, callback: MongoCallback<any>): void\n\n /**\n * Runs a command on the database as admin.\n *\n * @param command The command hash.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#executeDbAdminCommand\n */\n executeDbAdminCommand(\n command: Object,\n options?: ExecuteDbAdminCommandOptions,\n ): Promise<any>\n\n /**\n * Runs a command on the database as admin.\n *\n * @param command The command hash.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#executeDbAdminCommand\n */\n executeDbAdminCommand(\n command: Object,\n options: ExecuteDbAdminCommandOptions,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Retrieves this collections index info.\n *\n * @param name The name of the collection.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#indexInformation\n */\n indexInformation(name: string, callback: MongoCallback<any>): void\n\n /**\n * Retrieves this collections index info.\n *\n * @param name The name of the collection.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#indexInformation\n */\n indexInformation(\n name: string,\n options?: IndexInformationOptions,\n ): Promise<any>\n\n /**\n * Retrieves this collections index info.\n *\n * @param name The name of the collection.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#indexInformation\n */\n indexInformation(\n name: string,\n options: IndexInformationOptions,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Get the list of all collection information for the specified db.\n *\n * @param filter Query to filter collections by.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#listCollections\n */\n listCollections(\n filter: Object,\n options?: ListCollectionsOptions,\n ): CommandCursor\n\n /**\n * Logout user from server, fire off on all connections and remove all auth info.\n *\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#logout\n */\n logout(callback: MongoCallback<any>): void\n\n /**\n * Logout user from server, fire off on all connections and remove all auth info.\n *\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#logout\n */\n logout(options?: { dbName?: string }): Promise<any>\n\n /**\n * Logout user from server, fire off on all connections and remove all auth info.\n *\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#logout\n */\n logout(options: { dbName?: string }, callback: MongoCallback<any>): void\n\n /**\n * Open the database.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#open\n */\n open(): Promise<Db>\n\n /**\n * Open the database\n *\n * @param callback Callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#open\n */\n open(callback: MongoCallback<Db>): void\n\n /**\n *\n * @param username\n * @param callback\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#removeUser\n */\n removeUser(username: string, callback: MongoCallback<any>): void\n removeUser(\n username: string,\n options?: { w?: number | string; wtimeout?: number; j?: boolean },\n ): Promise<any>\n removeUser(\n username: string,\n options: { w?: number | string; wtimeout?: number; j?: boolean },\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Rename a collection.\n *\n * @param fromCollection Name of current collection to rename.\n * @param toCollection New name of of the collection.\n * @param callback The results callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#renameCollection\n */\n renameCollection(\n fromCollection: string,\n toCollection: string,\n callback: MongoCallback<Collection<any>>,\n ): void\n\n /**\n * Rename a collection.\n *\n * @param fromCollection Name of current collection to rename.\n * @param toCollection New name of of the collection.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#renameCollection\n */\n renameCollection(\n fromCollection: string,\n toCollection: string,\n options?: { dropTarget?: boolean },\n ): Promise<Collection<any>>\n\n /**\n * Rename a collection.\n *\n * @param fromCollection Name of current collection to rename.\n * @param toCollection New name of of the collection.\n * @param options Optional settings.\n * @param callback The results callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#renameCollection\n */\n renameCollection(\n fromCollection: string,\n toCollection: string,\n options: { dropTarget?: boolean },\n callback: MongoCallback<Collection<any>>,\n ): void\n\n /**\n * Get all the db statistics.\n *\n * @param callback The collection result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#stats\n */\n stats(callback: MongoCallback<any>): void\n\n /**\n * Get all the db statistics.\n *\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#stats\n */\n stats(options?: { scale?: number }): Promise<any>\n\n /**\n * Get all the db statistics.\n *\n * @param options Optional settings.\n * @param callback The collection result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#stats\n */\n stats(options: { scale?: number }, callback: MongoCallback<any>): void\n\n /**\n * Create a new Change Stream, watching for new changes (insertions, updates, replacements, deletions, and invalidations) in this database. Will ignore all changes to system collections.\n * @param pipeline An array of aggregation pipeline stages through which to pass change stream documents. This allows for filtering (using $match) and manipulating the change stream documents.\n * @param options Optional settings.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#watch\n */\n watch(\n pipeline?: Object[],\n options?: ChangeStreamOptions & {\n startAtClusterTime?: Timestamp\n session?: ClientSession\n },\n ): ChangeStream\n}\n\n/**\n * Server.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Server.html\n */\nexport declare class Server extends EventEmitter {\n /**\n *\n * @param host The host for the server, can be either an IP4, IP6 or domain socket style host.\n * @param port The server port if IP4.\n * @param options Optional.\n */\n constructor(host: string, port: number, options?: ServerOptions)\n\n /**\n * All raw connections.\n */\n connections(): Array<any>\n}\n\n/**\n * ReplSet.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/ReplSet.html\n */\nexport declare class ReplSet extends EventEmitter {\n /**\n *\n * @param servers A seedlist of servers participating in the replicaset.\n * @param options Optional.\n */\n constructor(servers: Array<Server>, options?: ReplSetOptions)\n\n /**\n * All raw connections\n */\n connections(): Array<any>\n}\n\n/**\n * Mongos.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Mongos.html\n */\nexport declare class Mongos extends EventEmitter {\n /**\n *\n * @param servers A seedlist of servers participating in the replicaset.\n * @param options Optional.\n */\n constructor(servers: Array<Server>, options?: MongosOptions)\n\n /**\n * All raw connections\n */\n connections(): Array<any>\n}\n\n/**\n * Creates a new Db instance.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#addUser\n */\nexport interface DbAddUserOptions {\n /**\n * The write concern.\n */\n w?: string | number\n\n /**\n * The write concern timeout.\n */\n wtimeout?: number\n\n /**\n * Specify a journal write concern.\n */\n j?: boolean\n\n /**\n * Custom data associated with the user (only Mongodb 2.6 or higher).\n */\n customData?: Object\n\n /**\n * Roles associated with the created user (only Mongodb 2.6 or higher).\n */\n roles?: Object[]\n}\n\n/**\n * Creates a new Db instance.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#createCollection\n */\nexport interface CollectionCreateOptions {\n /**\n * The write concern.\n */\n w?: number | string\n\n /**\n * The write concern timeout.\n */\n wtimeout?: number\n\n /**\n * Specify a journal write concern.\n */\n j?: boolean\n\n /**\n * Return document results as raw BSON buffers.\n */\n raw?: boolean\n\n /**\n * A primary key factory object for generation of custom _id keys.\n */\n pkFactory?: Object\n\n /**\n * The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).\n */\n readPreference?: ReadPreference | string\n\n /**\n * Serialize functions on any object.\n */\n serializeFunctions?: boolean\n\n /**\n * Returns an error if the collection does not exist.\n */\n strict?: boolean\n\n /**\n * Create a capped collection.\n */\n capped?: boolean\n\n /**\n * The size of the capped collection in bytes.\n */\n size?: number\n\n /**\n * The maximum number of documents in the capped collection.\n */\n max?: number\n\n /**\n * Create an index on the _id field of the document, True by default on MongoDB 2.2 or higher off for version < 2.2.\n */\n autoIndexId?: boolean\n}\n\n/**\n * Creates a new Db instance.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#collection\n */\nexport interface DbCollectionOptions {\n /**\n * The write concern.\n */\n w?: number | string\n\n /**\n * The write concern timeout.\n */\n wtimeout?: number\n\n /**\n * Specify a journal write concern.\n */\n j?: boolean\n\n /**\n * Return document results as raw BSON buffers.\n */\n raw?: boolean\n\n /**\n * A primary key factory object for generation of custom _id keys.\n */\n pkFactory?: Object\n\n /**\n * The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).\n */\n readPreference?: ReadPreference | string\n\n /**\n * Serialize functions on any object.\n */\n serializeFunctions?: boolean\n\n /**\n * Returns an error if the collection does not exist.\n */\n strict?: boolean\n\n /**\n * Specify a read concern for the collection. (only MongoDB 3.2 or higher supported).\n */\n readConcern?: ReadConcern\n}\n\n/**\n * Creates an index on the db and collection collection.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#createIndex\n */\nexport interface MongodbIndexOptions {\n /**\n * The write concern.\n */\n w?: number | string\n\n /**\n * The write concern timeout.\n */\n wtimeout?: number\n\n /**\n * Specify a journal write concern.\n */\n j?: boolean\n\n /**\n * Creates an unique index.\n */\n unique?: boolean\n\n /**\n * Creates a sparse index.\n */\n sparse?: boolean\n\n /**\n * Creates the index in the background, yielding whenever possible.\n */\n background?: boolean\n\n /**\n * A unique index cannot be created on a key that has pre-existing duplicate values.\n * If you would like to create the index anyway, keeping the first document\n * the database indexes and deleting all subsequent documents that have duplicate value.\n */\n dropDups?: boolean\n\n /**\n * For geospatial indexes set the lower bound for the co-ordinates.\n */\n min?: number\n\n /**\n * For geospatial indexes set the high bound for the co-ordinates.\n */\n max?: number\n\n /**\n * Specify the format version of the indexes.\n */\n v?: number\n\n /**\n * Allows you to expire data on indexes applied to a data (MongoDB 2.2 or higher).\n */\n expireAfterSeconds?: number\n\n /**\n * Override the autogenerated index name (useful if the resulting name is larger than 128 bytes).\n */\n name?: string\n}\n\n/**\n * Admin.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html\n */\nexport interface Admin {\n /**\n * Add a user to the database.\n *\n * @param username The username.\n * @param password The password.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#addUser\n */\n addUser(\n username: string,\n password: string,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Add a user to the database.\n *\n * @param username The username.\n * @param password The password.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#addUser\n */\n addUser(\n username: string,\n password: string,\n options?: AddUserOptions,\n ): Promise<any>\n\n /**\n * Add a user to the database.\n *\n * @param username The username.\n * @param password The password.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#addUser\n */\n addUser(\n username: string,\n password: string,\n options: AddUserOptions,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Authenticate a user against the server.\n *\n * @param username The username.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#authenticate\n */\n authenticate(username: string, callback: MongoCallback<any>): void\n\n /**\n * Authenticate a user against the server.\n *\n * @param username The username.\n * @param password The password.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#authenticate\n */\n authenticate(username: string, password?: string): Promise<any>\n\n /**\n * Authenticate a user against the server.\n *\n * @param username The username.\n * @param password The password.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#authenticate\n */\n authenticate(\n username: string,\n password: string,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Retrieve the server information for the current instance of the db client\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#buildInfo\n */\n buildInfo(): Promise<any>\n\n /**\n * Retrieve the server information for the current instance of the db client\n *\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#buildInfo\n */\n buildInfo(callback: MongoCallback<any>): void\n\n /**\n * Execute a command.\n *\n * @param command The command hash.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#command\n */\n command(command: Object, callback: MongoCallback<any>): void\n\n /**\n * Execute a command.\n *\n * @param command The command hash.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#command\n */\n command(command: Object, options?: CommandOptions): Promise<any>\n\n /**\n * Execute a command.\n *\n * @param command The command hash.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#command\n */\n command(\n command: Object,\n options: CommandOptions,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * List the available databases.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#listDatabases\n */\n listDatabases(): Promise<any>\n\n /**\n * List the available databases.\n *\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#listDatabases\n */\n listDatabases(callback: MongoCallback<any>): void\n\n /**\n * Logout user from server, fire off on all connections and remove all auth info.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#logout.\n */\n logout(): Promise<any>\n\n /**\n * Logout user from server, fire off on all connections and remove all auth info.\n *\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#logout.\n */\n logout(callback: MongoCallback<any>): void\n\n /**\n * Ping the MongoDB server and retrieve results.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#ping\n */\n ping(): Promise<any>\n\n /**\n * Ping the MongoDB server and retrieve results.\n *\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#ping\n */\n ping(callback: MongoCallback<any>): void\n\n /**\n * Retrive the current profiling information for MongoDB.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#profilingInfo\n */\n profilingInfo(): Promise<any>\n\n /**\n * Retrive the current profiling information for MongoDB.\n *\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#profilingInfo\n */\n profilingInfo(callback: MongoCallback<any>): void\n\n /**\n * Retrieve the current profiling Level for MongoDB.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#profilingLevel\n */\n profilingLevel(): Promise<any>\n\n /**\n * Retrieve the current profiling Level for MongoDB.\n *\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#profilingLevel\n */\n profilingLevel(callback: MongoCallback<any>): void\n\n /**\n * Remove a user from a database.\n *\n * @param username The username.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#removeUser\n */\n removeUser(username: string, callback: MongoCallback<any>): void\n\n /**\n * Remove a user from a database.\n *\n * @param username The username.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#removeUser\n */\n removeUser(username: string, options?: FSyncOptions): Promise<any>\n\n /**\n * Remove a user from a database.\n *\n * @param username The username.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#removeUser\n */\n removeUser(\n username: string,\n options: FSyncOptions,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Get ReplicaSet status.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#replSetGetStatus\n */\n replSetGetStatus(): Promise<any>\n\n /**\n * Get ReplicaSet status.\n *\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#replSetGetStatus\n */\n replSetGetStatus(callback: MongoCallback<any>): void\n\n /**\n * Retrieve the server information for the current\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#serverInfo\n */\n serverInfo(): Promise<any>\n\n /**\n * instance of the db client\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#serverInfo\n * @param callback The command result callback.\n */\n serverInfo(callback: MongoCallback<any>): void\n\n /**\n * Retrieve this db's server status.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#serverStatus\n */\n serverStatus(): Promise<any>\n\n /**\n * Retrieve this db's server status.\n *\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#serverStatus\n */\n serverStatus(callback: MongoCallback<any>): void\n\n /**\n * Set the current profiling level of MongoDB.\n *\n * @param level The new profiling level (off, slow_only, all).\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#setProfilingLevel\n */\n setProfilingLevel(level: string): Promise<any>\n\n /**\n * Set the current profiling level of MongoDB.\n *\n * @param level The new profiling level (off, slow_only, all).\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#setProfilingLevel\n */\n setProfilingLevel(level: string, callback: MongoCallback<any>): void\n\n /**\n * Validate an existing collection\n *\n * @param collectionNme The name of the collection to validate.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#validateCollection\n */\n validateCollection(\n collectionNme: string,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Validate an existing collection\n *\n * @param collectionNme The name of the collection to validate.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#validateCollection\n */\n validateCollection(collectionNme: string, options?: Object): Promise<any>\n\n /**\n * Validate an existing collection\n *\n * @param collectionNme The name of the collection to validate.\n * @param options Optional settings.\n * @param callback The command result callback\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#validateCollection\n */\n validateCollection(\n collectionNme: string,\n options: Object,\n callback: MongoCallback<any>,\n ): void\n}\n\n/**\n * Add a user to the database.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#addUser\n */\nexport interface AddUserOptions {\n /**\n * The write concern.\n */\n w?: number | string\n\n /**\n * The write concern timeout.\n */\n wtimeout?: number\n\n /**\n * Specify a journal write concern.\n */\n j?: boolean\n\n /**\n * Specify a file sync write concern.\n */\n fsync: boolean\n\n /**\n * Custom data associated with the user (only Mongodb 2.6 or higher).\n */\n customData?: Object\n\n /**\n * Roles associated with the created user (only Mongodb 2.6 or higher).\n */\n roles?: Object[]\n}\nexport interface ListIndexesOptions {\n /**\n * The batchSize for the returned command cursor or if pre 2.8 the systems batch collection.\n */\n batchSize?: number\n\n /**\n * The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED,\n * ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).\n */\n readPreference?: ReadPreference | string\n}\n\nexport interface GroupOptions {\n /**\n * The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED,\n * ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).\n */\n readPreference?: ReadPreference | string\n}\n\n/**\n * Remove a user from a database.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#removeUser\n */\nexport interface FSyncOptions {\n /**\n * The write concern.\n */\n w?: number | string\n\n /**\n * The write concern timeout.\n */\n wtimeout?: number\n\n /**\n * Specify a journal write concern.\n */\n j?: boolean\n\n /**\n * Specify a file sync write concern.\n */\n fsync?: boolean\n}\n\nexport interface FindOneAndDeleteOptions {\n /**\n * Limits the fields to return for all matching documents.\n */\n projection?: Object\n\n /**\n * Determines which document the operation modifies if the query selects multiple documents.\n */\n sort?: Object\n\n /**\n * The maximum amount of time to allow the query to run.\n */\n maxTimeMS?: number\n}\n\n/**\n * Create a new ObjectID instance.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/ObjectID.html\n */\nexport declare class ObjectID {\n constructor(s?: string | number)\n\n /**\n * The generation time of this ObjectId instance.\n */\n generationTime: number\n\n /**\n * Creates an ObjectID from a hex string representation of an ObjectID.\n */\n static createFromHexString(hexString: string): ObjectID\n\n /**\n * Creates an ObjectID from a second based number, with the rest of the ObjectID zeroed out. Used for comparisons or sorting the ObjectID.\n */\n static createFromTime(time: number): ObjectID\n\n /**\n * Checks if a value is a valid bson ObjectId.\n */\n static isValid(id: any): boolean\n\n /**\n * Compares the equality of this ObjectID with otherID.\n */\n equals(otherID: ObjectID): boolean\n\n /**\n * Generate a 12 byte id buffer used in ObjectID's.\n */\n generate(time?: number): string\n\n /**\n * Returns the generation date (accurate up to the second) that this ID was generated.\n *\n */\n getTimestamp(): Date\n\n /**\n * Return the ObjectID id as a 24 byte hex string representation.\n */\n toHexString(): string\n\n /**\n * Get the timestamp and validate correctness.\n */\n toString(): string\n}\n\n/**\n * A class representation of the BSON Binary type.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Binary.html\n */\nexport declare class Binary {\n /**\n * @param buffer A buffer object containing the binary data.\n * @param subType The option binary type.\n */\n constructor(buffer: Buffer, subType?: number)\n\n /**\n * Byte Array BSON type.\n */\n static SUBTYPE_BYTE_ARRAY: number\n\n /**\n * Default BSON type.\n */\n static SUBTYPE_DEFAULT: number\n\n /**\n * Function BSON type.\n */\n static SUBTYPE_FUNCTION: number\n\n /**\n * MD5 BSON type.\n */\n static SUBTYPE_MD5: number\n\n /**\n * User BSON type.\n */\n static SUBTYPE_USER_DEFINED: number\n\n /**\n * UUID BSON type.\n */\n static SUBTYPE_UUID: number\n\n /**\n * OLD UUID BSON type\n */\n static SUBTYPE_UUID_OLD: number\n\n /**\n * The length of the binary.\n */\n length(): number\n\n /**\n * Updates this binary with byte_value.\n *\n * @param byte_value A single byte we wish to write.\n */\n put(byte_value: number | string): void\n\n /**\n * Reads length bytes starting at position.\n *\n * @param position Read from the given position in the Binary.\n * @param length The number of bytes to read.\n */\n read(position: number, length: number): Buffer\n\n /**\n * Returns the value of this binary as a string.\n */\n value(): string\n\n /**\n * Writes a buffer or string to the binary\n *\n * @param buffer A string or buffer to be written to the Binary BSON object.\n * @param offset Specify the binary of where to write the content.\n */\n write(buffer: Buffer | string, offset: number): void\n}\n/**\n * A class representation of the BSON Double type.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Double.html\n */\nexport declare class Double {\n /**\n * @param value The number we want to represent as a double.\n */\n constructor(value: number)\n\n /**\n * Access the number value.\n */\n valueOf(): number\n}\n\n/**\n * Long\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Long.html\n */\nexport declare class Long {\n /**\n * @param low The low (signed) 32 bits of the Long.\n * @param high The high (signed) 32 bits of the Long.\n */\n constructor(low: number, high: number)\n\n static MAX_VALUE: Long\n static MIN_VALUE: Long\n static NEG_ONE: Long\n static ONE: Long\n static ZERO: Long\n\n /**\n * Returns a Long representing the 64-bit integer that comes by concatenating the given high and low bits.\n * Each is assumed to use 32 bits.\n *\n * @param lowBits The low 32-bits.\n * @param highBits The high 32-bits.\n */\n static fromBits(lowBits: number, highBits: number): Long\n\n /**\n * Returns a Long representing the given (32-bit) integer value.\n *\n * @param value The 32-bit integer in question.\n */\n static fromInt(value: number): Long\n\n /**\n * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.\n *\n * @param value The number in question.\n */\n static fromNumber(value: number): Long\n\n /**\n * Returns a Long representation of the given string, written using the given radix.\n *\n * @param str The textual representation of the Long.\n * @param radix The radix in which the text is written.\n */\n static fromString(str: string, radix?: number): Long\n\n /**\n * Returns the sum of this and the given Long.\n *\n * @param other Long to add to this one.\n */\n add(other: Long): Long\n\n /**\n * Returns the bitwise-AND of this Long and the given one.\n *\n * @param other The Long with which to AND.\n */\n and(other: Long): Long\n\n /**\n * Compares this Long with the given one.\n *\n * @param other Long to compare against.\n */\n compare(other: Long): number\n\n /**\n * Returns this Long divided by the given one.\n *\n * @param other Long by which to divide.\n */\n div(other: Long): Long\n\n /**\n * Return whether this Long equals the other.\n *\n * @param other Long to compare against.\n */\n equals(other: Long): boolean\n\n /**\n * Return the high 32-bits value.\n */\n getHighBits(): number\n\n /**\n * Return the low 32-bits value.\n */\n getLowBits(): number\n\n /**\n * Return the low unsigned 32-bits value.\n */\n getLowBitsUnsigned(): number\n\n /**\n * Returns the number of bits needed to represent the absolute value of this Long.\n */\n getNumBitsAbs(): number\n\n /**\n * Return whether this Long is greater than the other.\n *\n * @param other Long to compare against.\n */\n greaterThan(other: Long): number\n\n /**\n * Return whether this Long is greater than or equal to the other.\n *\n * @param other Long to compare against.\n */\n greaterThanOrEqual(other: Long): number\n\n /**\n * Return whether this value is negative.\n */\n isNegative(): boolean\n\n /**\n * Return whether this value is odd.\n */\n isOdd(): boolean\n\n /**\n * Return whether this value is zero.\n */\n isZero(): boolean\n\n /**\n * Return whether this Long is less than the other.\n *\n * @param other Long to compare against.\n */\n lessThan(other: Long): boolean\n\n /**\n * Return whether this Long is less than or equal to the other.\n *\n * @param other Long to compare against.\n */\n lessThanOrEqual(other: Long): boolean\n\n /**\n * Returns this Long modulo the given one.\n *\n * @param other Long by which to mod.\n */\n modulo(other: Long): Long\n\n /**\n * Returns the product of this and the given Long.\n *\n * @param other Long to multiply with this.\n */\n multiply(other: Long): Long\n\n /**\n * The negation of this value.\n */\n negate(): Long\n\n /**\n * The bitwise-NOT of this value.\n */\n not(): Long\n\n /**\n * Return whether this Long does not equal the other.\n *\n * @param other Long to compare against.\n */\n notEquals(other: Long): boolean\n\n /**\n * Returns the bitwise-OR of this Long and the given one.\n *\n * @param other The Long with which to OR.\n */\n or(other: Long): Long\n\n /**\n * Returns this Long with bits shifted to the left by the given amount.\n *\n * @param other The number of bits by which to shift.\n */\n shiftLeft(other: number): Long\n\n /**\n * Returns this Long with bits shifted to the right by the given amount.\n *\n * @param other The number of bits by which to shift.\n */\n shiftRight(other: number): Long\n\n /**\n * Returns this Long with bits shifted to the right by the given amount, with the new top bits matching the current sign bit.\n *\n * @param other The number of bits by which to shift.\n */\n shiftRightUnsigned(other: number): Long\n\n /**\n * Returns the difference of this and the given Long.\n *\n * @param other Long to subtract from this.\n */\n subtract(other: Long): Long\n\n /**\n * Return the int value.\n */\n toInt(): number\n\n /**\n * Return the JSON value.\n */\n toJSON(): string\n\n /**\n * Return the Number value.\n */\n toNumber(): number\n\n /**\n * Return the String value.\n *\n * @param opt_radix The radix in which the text should be written.\n */\n toString(opt_radix?: number): string\n\n /**\n * Returns the bitwise-XOR of this Long and the given one.\n *\n * @param other The Long with which to XOR.\n */\n xor(other: Long): Long\n}\n\n/**\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/MaxKey.html\n */\nexport declare class MaxKey {}\n\n/**\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/MinKey.html\n */\nexport declare class MinKey {}\n\n/**\n * Timestamp.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Timestamp.html\n */\nexport declare class Timestamp {\n /**\n * @param low The low (signed) 32 bits of the Timestamp.\n * @param high The high (signed) 32 bits of the Timestamp.\n */\n constructor(low: number, high: number)\n\n static MAX_VALUE: Timestamp\n static MIN_VALUE: Timestamp\n static NEG_ONE: Timestamp\n static ONE: Timestamp\n static ZERO: Timestamp\n\n /**\n * Returns a Timestamp representing the 64-bit integer that comes by concatenating the\n * given high and low bits. Each is assumed to use 32 bits..\n *\n * @param lowBits The low 32-bits.\n * @param highBits The high 32-bits.\n */\n static fromBits(lowBits: number, highBits: number): Timestamp\n\n /**\n * Returns a Timestamp representing the given (32-bit) integer value.\n *\n * @param value The 32-bit integer in question.\n */\n static fromInt(value: number): Timestamp\n\n /**\n * Returns a Timestamp representing the given value, provided that it is a finite number. Otherwise, zero is returned.\n *\n * @param value The number in question.\n */\n static fromNumber(value: number): Timestamp\n\n /**\n * Returns a Timestamp representation of the given string, written using the given radix.\n *\n * @param str The textual representation of the Timestamp.\n * @param radix The radix in which the text is written.\n */\n static fromString(str: string, radix?: number): Timestamp\n\n /**\n * Returns the sum of this and the given Timestamp.\n *\n * @param other Timestamp to add to this one.\n */\n add(other: Timestamp): Timestamp\n\n /**\n * Returns the bitwise-AND of this Timestamp and the given one.\n *\n * @param other Timestamp to add to this one.\n */\n and(other: Timestamp): Timestamp\n\n /**\n * Compares this Timestamp with the given one.\n *\n * @param other Timestamp to compare against.\n */\n compare(other: Timestamp): number\n\n /**\n * Returns this Timestamp divided by the given one.\n *\n * @param other Timestamp by which to divide.\n */\n div(other: Timestamp): Timestamp\n\n /**\n * Return whether this Timestamp equals the other\n *\n * @param other\n */\n equals(other: Timestamp): boolean\n\n /**\n * Return the high 32-bits value.\n */\n getHighBits(): number\n\n /**\n * Return the low 32-bits value.\n */\n getLowBits(): number\n\n /**\n * Return the low unsigned 32-bits value.\n */\n getLowBitsUnsigned(): number\n\n /**\n * Returns the number of bits needed to represent the absolute value of this Timestamp.\n */\n getNumBitsAbs(): number\n\n /**\n * Return whether this Timestamp is greater than the other.\n *\n * @param other Timestamp to compare against.\n */\n greaterThan(other: Timestamp): number\n\n /**\n * Return whether this Timestamp is greater than or equal to the other.\n *\n * @param other Timestamp to compare against.\n */\n greaterThanOrEqual(other: Timestamp): number\n\n /**\n * Return whether this value is negative.\n */\n isNegative(): boolean\n\n /**\n * IsOdd.\n * Return whether this value is odd.\n */\n isOdd(): boolean\n\n /**\n * Return whether this value is zero.\n */\n isZero(): boolean\n\n /**\n * Return whether this Timestamp is less than the other.\n *\n * @param other Timestamp to compare against.\n */\n lessThan(other: Timestamp): boolean\n\n /**\n * Return whether this Timestamp is less than or equal to the other.\n *\n * @param other Timestamp to compare against.\n */\n lessThanOrEqual(other: Timestamp): boolean\n\n /**\n * Returns this Timestamp modulo the given one.\n *\n * @param other Timestamp by which to mod.\n */\n modulo(other: Timestamp): Timestamp\n\n /**\n * Returns the product of this and the given Timestamp.\n *\n * @param other Timestamp to multiply with this.\n */\n multiply(other: Timestamp): Timestamp\n\n /**\n * The negation of this value.\n */\n negate(): Timestamp\n\n /**\n * The bitwise-NOT of this value.\n */\n not(): Timestamp\n\n /**\n * Return whether this Timestamp does not equal the other.\n *\n * @param other Timestamp to compare against.\n */\n notEquals(other: Timestamp): boolean\n\n /**\n * Returns the bitwise-OR of this Timestamp and the given one.\n *\n * @param other The Timestamp with which to OR.\n */\n or(other: Timestamp): Timestamp\n\n /**\n * Returns this Timestamp with bits shifted to the left by the given amount.\n *\n * @param other The number of bits by which to shift.\n */\n shiftLeft(other: number): Timestamp\n\n /**\n * Returns this Timestamp with bits shifted to the right by the given amount.\n *\n * @param other The number of bits by which to shift.\n */\n shiftRight(other: number): Timestamp\n\n /**\n * Returns this Timestamp with bits shifted to the right by the given amount, with the new top bits matching the current sign bit.\n *\n * @param other\n */\n shiftRightUnsigned(other: number): Timestamp\n\n /**\n * Returns the difference of this and the given Timestamp.\n *\n * @param other Timestamp to subtract from this.\n */\n subtract(other: Timestamp): Timestamp\n\n /**\n * Return the int value.\n */\n toInt(): number\n\n /**\n * Return the JSON value.\n */\n toJSON(): string\n\n /**\n * Return the Number value.\n */\n toNumber(): number\n\n /**\n * Return the String value.\n *\n * @param radix The radix in which the text should be written.\n */\n toString(radix?: number): string\n\n /**\n * Returns the bitwise-XOR of this Timestamp and the given one.\n *\n * @param other The Timestamp with which to XOR.\n */\n xor(other: Timestamp): Timestamp\n}\n\nexport interface CollectionDeleteOneOptions {\n /**\n * The write concern.\n */\n w?: number | string\n\n /**\n * The write concern timeout.\n */\n wtimmeout?: number\n\n /**\n * Specify a journal write concern.\n */\n j?: boolean\n\n /**\n * Allow driver to bypass schema validation in MongoDB 3.2 or higher.\n */\n bypassDocumentValidation?: boolean\n}\n\nexport interface CollectionDistinctOptions {\n /**\n * The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED,\n * ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).\n */\n readPreference?: ReadPreference | string\n}\n\n/**\n * Create a new ObjectID instance.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html\n */\nexport interface Collection<T> {\n /**\n * Get the collection name.\n */\n collectionName: string\n\n /**\n * Get the full collection namespace.\n */\n namespace: string\n\n /**\n * The current write concern values.\n */\n writeConcern: WriteConcern\n\n /**\n * The current read concern values.\n */\n readConcern: ReadConcern\n\n /**\n * Get current index hint for collection.\n */\n hint: any\n\n /**\n * Execute an aggregation framework pipeline against the collection, needs MongoDB >= 2.2\n *\n * @param pipeline Array containing all the aggregation framework commands for the execution.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#aggregate\n */\n aggregate(\n pipeline: Object[],\n callback: MongoCallback<any>,\n ): AggregationCursor<any>\n\n /**\n * Execute an aggregation framework pipeline against the collection, needs MongoDB >= 2.2\n *\n * @param pipeline Array containing all the aggregation framework commands for the execution.\n * @param options Optional.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#aggregate\n */\n aggregate(\n pipeline: Object[],\n options?: CollectionAggregationOptions,\n callback?: MongoCallback<any>,\n ): AggregationCursor<any>\n\n /**\n * Execute an aggregation framework pipeline against the collection, needs MongoDB >= 2.2\n *\n * @param pipeline Array containing all the aggregation framework commands for the execution.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#aggregate\n */\n aggregate<T>(\n pipeline: Object[],\n callback: MongoCallback<any>,\n ): AggregationCursor<T>\n\n /**\n * Execute an aggregation framework pipeline against the collection, needs MongoDB >= 2.2\n *\n * @param pipeline Array containing all the aggregation framework commands for the execution.\n * @param options Optional.\n * @param callback Optional\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#aggregate\n */\n aggregate<T>(\n pipeline: Object[],\n options?: CollectionAggregationOptions,\n callback?: MongoCallback<any>,\n ): AggregationCursor<T>\n\n /**\n * BulkWrite.\n *\n * @param operations Bulk operations to perform.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#bulkWrite\n */\n bulkWrite(\n operations: Object[],\n callback: MongoCallback<BulkWriteOpResultObject>,\n ): void\n\n /**\n * BulkWrite.\n *\n * @param operations Bulk operations to perform.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#bulkWrite\n */\n bulkWrite(\n operations: Object[],\n options?: CollectionBulkWriteOptions,\n ): Promise<BulkWriteOpResultObject>\n\n /**\n * BulkWrite.\n *\n * @param operations Bulk operations to perform.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#bulkWrite\n */\n bulkWrite(\n operations: Object[],\n options: CollectionBulkWriteOptions,\n callback: MongoCallback<BulkWriteOpResultObject>,\n ): void\n\n /**\n * Count number of matching documents in the db to a query.\n *\n * @param query The query for the count.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#count\n */\n count(query: FilterQuery<T>, callback: MongoCallback<number>): void\n\n /**\n * Count number of matching documents in the db to a query.\n *\n * @param query The query for the count.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#count\n */\n count(\n query: FilterQuery<T>,\n options?: MongoCountPreferences,\n ): Promise<number>\n\n /**\n * Count number of matching documents in the db to a query.\n *\n * @param query The query for the count=\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#count\n */\n count(\n query: FilterQuery<T>,\n options: MongoCountPreferences,\n callback: MongoCallback<number>,\n ): void\n\n /**\n * Count number of matching documents in the db to a query.\n *\n * @param query The query for the countDocuments.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#countDocumentst\n */\n countDocuments(query: FilterQuery<T>, callback: MongoCallback<number>): void\n\n /**\n * Count number of matching documents in the db to a query.\n *\n * @param query The query for the count.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#countDocuments\n */\n countDocuments(\n query: FilterQuery<T>,\n options?: MongoCountPreferences,\n ): Promise<number>\n\n /**\n * Count number of matching documents in the db to a query.\n *\n * @param query The query for the count=\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#countDocuments\n */\n countDocuments(\n query: FilterQuery<T>,\n options: MongoCountPreferences,\n callback: MongoCallback<number>,\n ): void\n\n /**\n * Creates an index on the db and collection collection.\n *\n * @param fieldOrSpec Defines the index.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#createIndex\n */\n createIndex(\n fieldOrSpec: string | any,\n callback: MongoCallback<string>,\n ): void\n\n /**\n * Creates an index on the db and collection collection.\n *\n * @param fieldOrSpec Defines the index.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#createIndex\n */\n createIndex(\n fieldOrSpec: string | any,\n options?: MongodbIndexOptions,\n ): Promise<string>\n\n /**\n * Creates an index on the db and collection collection.\n *\n * @param fieldOrSpec Defines the index.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#createIndex\n */\n createIndex(\n fieldOrSpec: string | any,\n options: MongodbIndexOptions,\n callback: MongoCallback<string>,\n ): void\n\n /**\n * CreateIndexes.\n *\n * @param indexSpecs An array of index specifications to be created.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#createIndexes and http://docs.mongodb.org/manual/reference/command/createIndexes/\n */\n createIndexes(indexSpecs: Object[]): Promise<any>\n\n /**\n * CreateIndexes.\n *\n * @param indexSpecs An array of index specifications to be created.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#createIndexes and http://docs.mongodb.org/manual/reference/command/createIndexes/\n */\n createIndexes(indexSpecs: Object[], callback: MongoCallback<any>): void\n\n /**\n * Delete multiple documents on MongoDB.\n *\n * @param filter The Filter used to select the documents to remove.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#deleteMany\n */\n deleteMany(\n filter: FilterQuery<T>,\n callback: MongoCallback<DeleteWriteOpResultObject>,\n ): void\n\n /**\n * Delete multiple documents on MongoDB.\n *\n * @param filter The Filter used to select the documents to remove.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#deleteMany\n */\n deleteMany(\n filter: FilterQuery<T>,\n options?: CollectionOptions,\n ): Promise<DeleteWriteOpResultObject>\n\n /**\n * Delete multiple documents on MongoDB.\n *\n * @param filter The Filter used to select the documents to remove.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#deleteMany\n */\n deleteMany(\n filter: FilterQuery<T>,\n options: CollectionOptions,\n callback: MongoCallback<DeleteWriteOpResultObject>,\n ): void\n\n /**\n * Delete a document on MongoDB.\n *\n * @param filter The Filter used to select the document to remove.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#deleteOne\n */\n deleteOne(\n filter: FilterQuery<T>,\n callback: MongoCallback<DeleteWriteOpResultObject>,\n ): void\n\n /**\n * Delete a document on MongoDB.\n *\n * @param filter The Filter used to select the document to remove.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#deleteOne\n */\n deleteOne(\n filter: FilterQuery<T>,\n options?: CollectionDeleteOneOptions,\n ): Promise<DeleteWriteOpResultObject>\n\n /**\n * Delete a document on MongoDB.\n *\n * @param filter The Filter used to select the document to remove.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#deleteOne\n */\n deleteOne(\n filter: FilterQuery<T>,\n options: CollectionDeleteOneOptions,\n callback: MongoCallback<DeleteWriteOpResultObject>,\n ): void\n\n /**\n * The distinct command returns returns a list of distinct values for the given key across a collection.\n *\n * @param key Field of the document to find distinct values for.\n * @param query The query for filtering the set of documents to which we apply the distinct filter.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#distinct\n */\n distinct(\n key: string,\n query: FilterQuery<T>,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * The distinct command returns returns a list of distinct values for the given key across a collection.\n *\n * @param key Field of the document to find distinct values for.\n * @param query The query for filtering the set of documents to which we apply the distinct filter.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#distinct\n */\n distinct(\n key: string,\n query: FilterQuery<T>,\n options?: CollectionDistinctOptions,\n ): Promise<any>\n\n /**\n * The distinct command returns returns a list of distinct values for the given key across a collection.\n *\n * @param key Field of the document to find distinct values for.\n * @param query The query for filtering the set of documents to which we apply the distinct filter.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#distinct\n */\n distinct(\n key: string,\n query: FilterQuery<T>,\n options: CollectionDistinctOptions,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Drop the collection from the database, removing it permanently. New accesses will create a new collection.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#drop\n */\n drop(): Promise<any>\n\n /**\n * Drop the collection from the database, removing it permanently. New accesses will create a new collection.\n *\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#drop\n */\n drop(callback: MongoCallback<any>): void\n\n /**\n * Drops an index from this collection.\n *\n * @param indexName Name of the index to drop.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#dropIndex\n */\n dropIndex(indexName: string, callback: MongoCallback<any>): void\n\n /**\n * Drops an index from this collection.\n *\n * @param indexName Name of the index to drop.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#dropIndex\n */\n dropIndex(indexName: string, options?: CollectionOptions): Promise<any>\n\n /**\n * Drops an index from this collection.\n *\n * @param indexName Name of the index to drop.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#dropIndex\n */\n dropIndex(\n indexName: string,\n options: CollectionOptions,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Drops all indexes from this collection.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#dropIndexes\n */\n dropIndexes(): Promise<any>\n\n /**\n * Drops all indexes from this collection.\n *\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#dropIndexes\n */\n dropIndexes(callback?: MongoCallback<any>): void\n\n /**\n * Creates a cursor for a query that can be used to iterate over results from MongoDB.\n *\n * @param query The cursor query object.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#find\n */\n find(query?: Object): Cursor<any>\n\n /**\n * Creates a cursor for a query that can be used to iterate over results from MongoDB.\n *\n * @param query The cursor query object.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#find\n */\n find<T>(query?: FilterQuery<T>): Cursor<T>\n\n /** @deprecated */\n find(\n query: FilterQuery<T>,\n fields?: Object,\n skip?: number,\n limit?: number,\n timeout?: number,\n ): Cursor<any>\n\n /**\n * Fetches the first document that matches the query.\n *\n * @param query Query for find Operation.\n * @param callback The command result callback.\n * @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#findOne\n */\n findOne(query: FilterQuery<T>, callback: MongoCallback<any>): void\n\n /**\n * Fetches the first document that matches the query.\n *\n * @param query Query for find Operation.\n * @param options Optional.\n * @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#findOne\n */\n findOne(\n query: FilterQuery<T>,\n options?: MongodbFindOneOptions,\n ): Promise<any>\n\n /**\n * Fetches the first document that matches the query.\n *\n * @param query Query for find Operation.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#findOne\n */\n findOne(\n query: FilterQuery<T>,\n options: MongodbFindOneOptions,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Find a document and delete it in one atomic operation, requires a write lock for the duration of the operation.\n *\n * @param filter Document selection filter.\n * @param callback The collection result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#findOneAndDelete\n */\n findOneAndDelete(\n filter: FilterQuery<T>,\n callback: MongoCallback<FindAndModifyWriteOpResultObject>,\n ): void\n\n /**\n * Find a document and delete it in one atomic operation, requires a write lock for the duration of the operation.\n *\n * @param filter Document selection filter.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#findOneAndDelete\n */\n findOneAndDelete(\n filter: FilterQuery<T>,\n options?: FindOneAndDeleteOptions,\n ): Promise<FindAndModifyWriteOpResultObject>\n\n /**\n * Find a document and delete it in one atomic operation, requires a write lock for the duration of the operation.\n *\n * @param filter Document selection filter.\n * @param options Optional settings.\n * @param callback The collection result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#findOneAndDelete\n */\n findOneAndDelete(\n filter: FilterQuery<T>,\n options: FindOneAndDeleteOptions,\n callback: MongoCallback<FindAndModifyWriteOpResultObject>,\n ): void\n\n /**\n * Find a document and replace it in one atomic operation, requires a write lock for the duration of the operation.\n *\n * @param filter Document selection filter.\n * @param replacement Document replacing the matching document.\n * @param callback The collection result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#findOneAndReplace\n */\n findOneAndReplace(\n filter: FilterQuery<T>,\n replacement: Object,\n callback: MongoCallback<FindAndModifyWriteOpResultObject>,\n ): void\n\n /**\n * Find a document and replace it in one atomic operation, requires a write lock for the duration of the operation.\n *\n * @param filter Document selection filter.\n * @param replacement Document replacing the matching document.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#findOneAndReplace\n */\n findOneAndReplace(\n filter: FilterQuery<T>,\n replacement: Object,\n options?: FindOneAndReplaceOption,\n ): Promise<FindAndModifyWriteOpResultObject>\n\n /**\n * Find a document and replace it in one atomic operation, requires a write lock for the duration of the operation.\n *\n * @param filter Document selection filter.\n * @param replacement Document replacing the matching document.\n * @param options Optional settings.\n * @param callback The collection result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#findOneAndReplace\n */\n findOneAndReplace(\n filter: FilterQuery<T>,\n replacement: Object,\n options: FindOneAndReplaceOption,\n callback: MongoCallback<FindAndModifyWriteOpResultObject>,\n ): void\n\n /**\n * Find a document and update it in one atomic operation, requires a write lock for the duration of the operation.\n *\n * @param filter Document selection filter.\n * @param update Update operations to be performed on the document.\n * @param callback The collection result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#findOneAndUpdate\n */\n findOneAndUpdate(\n filter: FilterQuery<T>,\n update: UpdateQuery<T>,\n callback: MongoCallback<FindAndModifyWriteOpResultObject>,\n ): void\n\n /**\n * Find a document and update it in one atomic operation, requires a write lock for the duration of the operation.\n *\n * @param filter Document selection filter.\n * @param update Update operations to be performed on the document.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#findOneAndUpdate\n */\n findOneAndUpdate(\n filter: FilterQuery<T>,\n update: UpdateQuery<T>,\n options?: FindOneAndReplaceOption,\n ): Promise<FindAndModifyWriteOpResultObject>\n\n /**\n * Find a document and update it in one atomic operation, requires a write lock for the duration of the operation.\n *\n * @param filter Document selection filter.\n * @param update Update operations to be performed on the document.\n * @param options Optional settings.\n * @param callback The collection result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#findOneAndUpdate\n */\n findOneAndUpdate(\n filter: FilterQuery<T>,\n update: UpdateQuery<T>,\n options: FindOneAndReplaceOption,\n callback: MongoCallback<FindAndModifyWriteOpResultObject>,\n ): void\n\n /**\n * Execute a geo search using a geo haystack index on a collection.\n *\n * @param x Point to search on the x axis, ensure the indexes are ordered in the same order.\n * @param y Point to search on the y axis, ensure the indexes are ordered in the same order.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#geoHaystackSearch\n */\n geoHaystackSearch(x: number, y: number, callback: MongoCallback<any>): void\n\n /**\n * Execute a geo search using a geo haystack index on a collection.\n *\n * @param x Point to search on the x axis, ensure the indexes are ordered in the same order.\n * @param y Point to search on the y axis, ensure the indexes are ordered in the same order.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#geoHaystackSearch\n */\n geoHaystackSearch(\n x: number,\n y: number,\n options?: GeoHaystackSearchOptions,\n ): Promise<any>\n\n /**\n * Execute a geo search using a geo haystack index on a collection.\n *\n * @param x Point to search on the x axis, ensure the indexes are ordered in the same order.\n * @param y Point to search on the y axis, ensure the indexes are ordered in the same order.\n * @param options Optional settings\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#geoHaystackSearch\n */\n geoHaystackSearch(\n x: number,\n y: number,\n options: GeoHaystackSearchOptions,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Execute the geoNear command to search for items in the collection.\n *\n * @param x Point to search on the x axis, ensure the indexes are ordered in the same order.\n * @param y Point to search on the y axis, ensure the indexes are ordered in the same order.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#geoNear\n */\n geoNear(x: number, y: number, callback: MongoCallback<any>): void\n\n /**\n * Execute the geoNear command to search for items in the collection.\n *\n * @param x Point to search on the x axis, ensure the indexes are ordered in the same order.\n * @param y Point to search on the y axis, ensure the indexes are ordered in the same order.\n * @param options Optionals.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#geoNear\n */\n geoNear(x: number, y: number, options?: GeoNearOptions): Promise<any>\n\n /**\n * Execute the geoNear command to search for items in the collection.\n *\n * @param x Point to search on the x axis, ensure the indexes are ordered in the same order.\n * @param y Point to search on the y axis, ensure the indexes are ordered in the same order.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#geoNear\n */\n geoNear(\n x: number,\n y: number,\n options: GeoNearOptions,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Run a group command across a collection.\n *\n * @param keys An object, array or function expressing the keys to group by.\n * @param condition An optional condition that must be true for a row to be considered.\n * @param initial Initial value of the aggregation counter object.\n * @param reduce The reduce function aggregates (reduces) the objects iterated.\n * @param finalize An optional function to be run on each item in the result set just before the item is returned.\n * @param command Specify if you wish to run using the internal group command or using eval, default is true.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#group\n */\n group(\n keys: Object | Array<any> | Function | Code,\n condition: Object,\n initial: Object,\n reduce: Function | Code,\n finalize: Function | Code,\n command: boolean,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Run a group command across a collection.\n *\n * @param keys An object, array or function expressing the keys to group by.\n * @param condition An optional condition that must be true for a row to be considered.\n * @param initial Initial value of the aggregation counter object.\n * @param reduce The reduce function aggregates (reduces) the objects iterated.\n * @param finalize An optional function to be run on each item in the result set just before the item is returned.\n * @param command Specify if you wish to run using the internal group command or using eval, default is true.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#group\n */\n group(\n keys: Object | Array<any> | Function | Code,\n condition: Object,\n initial: Object,\n reduce: Function | Code,\n finalize: Function | Code,\n command: boolean,\n options?: GroupOptions,\n ): Promise<any>\n\n /**\n * Run a group command across a collection.\n *\n * @param keys An object, array or function expressing the keys to group by.\n * @param condition An optional condition that must be true for a row to be considered.\n * @param initial Initial value of the aggregation counter object.\n * @param reduce The reduce function aggregates (reduces) the objects iterated.\n * @param finalize An optional function to be run on each item in the result set just before the item is returned.\n * @param command Specify if you wish to run using the internal group command or using eval, default is true.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#group\n */\n group(\n keys: Object | Array<any> | Function | Code,\n condition: Object,\n initial: Object,\n reduce: Function | Code,\n finalize: Function | Code,\n command: boolean,\n options: GroupOptions,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Retrieve all the indexes on the collection.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#indexes\n */\n indexes(): Promise<any>\n\n /**\n * Retrieve all the indexes on the collection.\n *\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#indexes\n */\n indexes(callback: MongoCallback<any>): void\n\n /**\n * Checks if one or more indexes exist on the collection, fails on first non-existing index.\n *\n * @param indexes One or more index names to check.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#indexExists\n */\n indexExists(indexes: string | string[]): Promise<boolean>\n\n /**\n * Checks if one or more indexes exist on the collection, fails on first non-existing index.\n *\n * @param indexes One or more index names to check.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#indexExists\n */\n indexExists(\n indexes: string | string[],\n callback: MongoCallback<boolean>,\n ): void\n\n /**\n * Retrieves this collections index info.\n *\n * @param callback The command result callback\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#indexInformation\n */\n indexInformation(callback: MongoCallback<any>): void\n\n /**\n * Retrieves this collections index info.\n *\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#indexInformation\n */\n indexInformation(options?: { full: boolean }): Promise<any>\n\n /**\n * Retrieves this collections index info.\n *\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#indexInformation\n */\n indexInformation(\n options: { full: boolean },\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Initiate an In order bulk write operation, operations will be serially executed in the order they are added,\n * creating a new operation for each switch in types.\n *\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#initializeOrderedBulkOp\n */\n initializeOrderedBulkOp(options?: CollectionOptions): OrderedBulkOperation\n\n /**\n * Initiate a Out of order batch write operation. All operations will be buffered into insert/update/remove commands executed out of order.\n *\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#initializeUnorderedBulkOp\n */\n initializeUnorderedBulkOp(\n options?: CollectionOptions,\n ): UnorderedBulkOperation\n\n // http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#insertOne\n /** @deprecated Use insertOne, insertMany or bulkWrite */\n insert(docs: Object, callback: MongoCallback<InsertOneWriteOpResult>): void\n /** @deprecated Use insertOne, insertMany or bulkWrite */\n insert(\n docs: Object,\n options?: CollectionInsertOneOptions,\n ): Promise<InsertOneWriteOpResult>\n /** @deprecated Use insertOne, insertMany or bulkWrite */\n insert(\n docs: Object,\n options: CollectionInsertOneOptions,\n callback: MongoCallback<InsertOneWriteOpResult>,\n ): void\n\n /**\n * InsertMany.\n *\n * @param docs Documents to insert.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#insertMany\n */\n insertMany(\n docs: Object[],\n callback: MongoCallback<InsertWriteOpResult>,\n ): void\n\n /**\n * InsertMany.\n *\n * @param docs Documents to insert.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#insertMany\n */\n insertMany(\n docs: Object[],\n options?: CollectionInsertManyOptions,\n ): Promise<InsertWriteOpResult>\n\n /**\n * InsertMany.\n *\n * @param docs Documents to insert.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#insertMany\n */\n insertMany(\n docs: Object[],\n options: CollectionInsertManyOptions,\n callback: MongoCallback<InsertWriteOpResult>,\n ): void\n\n /**\n * InsertOne.\n *\n * @param docs Document to insert.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#insertOne\n */\n insertOne(\n docs: Object,\n callback: MongoCallback<InsertOneWriteOpResult>,\n ): void\n\n /**\n * InsertOne.\n *\n * @param docs Document to insert.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#insertOne\n */\n insertOne(\n docs: Object,\n options?: CollectionInsertOneOptions,\n ): Promise<InsertOneWriteOpResult>\n\n /**\n * InsertOne.\n *\n * @param docs Document to insert.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#insertOne\n */\n insertOne(\n docs: Object,\n options: CollectionInsertOneOptions,\n callback: MongoCallback<InsertOneWriteOpResult>,\n ): void\n\n /**\n * Returns if the collection is a capped collection.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#isCapped\n */\n isCapped(): Promise<any>\n\n /**\n * Returns if the collection is a capped collection.\n *\n * @param callback The results callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#isCapped\n */\n isCapped(callback: MongoCallback<any>): void\n\n /**\n * Get the list of all indexes information for the collection.\n *\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#listIndexes\n */\n listIndexes(options?: ListIndexesOptions): CommandCursor\n\n /**\n * Run Map Reduce across a collection. Be aware that the inline option for out will return an array of results not a collection.\n *\n * @param map The mapping function.\n * @param reduce The reduce function.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#mapReduce\n */\n mapReduce(\n map: Function | string,\n reduce: Function | string,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Run Map Reduce across a collection. Be aware that the inline option for out will return an array of results not a collection.\n *\n * @param map The mapping function.\n * @param reduce The reduce function.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#mapReduce\n */\n mapReduce(\n map: Function | string,\n reduce: Function | string,\n options?: MapReduceOptions,\n ): Promise<any>\n\n /**\n * Run Map Reduce across a collection. Be aware that the inline option for out will return an array of results not a collection.\n *\n * @param map The mapping function.\n * @param reduce The reduce function.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#mapReduce\n */\n mapReduce(\n map: Function | string,\n reduce: Function | string,\n options: MapReduceOptions,\n callback: MongoCallback<any>,\n ): void\n\n /**\n * Returns the options of the collection.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#options\n */\n options(): Promise<any>\n\n /**\n * Returns the options of the collection.\n *\n * @param callback The results callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#options\n */\n options(callback: MongoCallback<any>): void\n\n /**\n * Return N number of parallel cursors for a collection allowing parallel reading of entire collection. There are\n * no ordering guarantees for returned results.\n *\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#parallelCollectionScan\n */\n parallelCollectionScan(callback: MongoCallback<Cursor<any>[]>): void\n\n /**\n * Return N number of parallel cursors for a collection allowing parallel reading of entire collection. There are\n * no ordering guarantees for returned results.\n *\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#parallelCollectionScan\n */\n parallelCollectionScan(\n options?: ParallelCollectionScanOptions,\n ): Promise<Cursor<any>[]>\n\n /**\n * Return N number of parallel cursors for a collection allowing parallel reading of entire collection. There are\n * no ordering guarantees for returned results.\n *\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#parallelCollectionScan\n */\n parallelCollectionScan(\n options: ParallelCollectionScanOptions,\n callback: MongoCallback<Cursor<any>[]>,\n ): void\n\n /**\n * Reindex all indexes on the collection.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#reIndex\n */\n reIndex(): Promise<any>\n\n /**\n * Reindex all indexes on the collection.\n *\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#reIndex\n */\n reIndex(callback: MongoCallback<any>): void\n\n // http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#remove\n /** @deprecated Use use deleteOne, deleteMany or bulkWrite */\n remove(selector: Object, callback: MongoCallback<WriteOpResult>): void\n /** @deprecated Use use deleteOne, deleteMany or bulkWrite */\n remove(\n selector: Object,\n options?: CollectionOptions & { single?: boolean },\n ): Promise<WriteOpResult>\n /** @deprecated Use use deleteOne, deleteMany or bulkWrite */\n remove(\n selector: Object,\n options?: CollectionOptions & { single?: boolean },\n callback?: MongoCallback<WriteOpResult>,\n ): void\n\n /**\n * Rename the collection.\n *\n * @param newName New name of of the collection.\n * @param callback The results callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#rename\n */\n rename(newName: string, callback: MongoCallback<Collection<T>>): void\n\n /**\n * Rename the collection.\n *\n * @param newName New name of of the collection.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#rename\n */\n rename(\n newName: string,\n options?: { dropTarget?: boolean },\n ): Promise<Collection<T>>\n\n /**\n * Rename the collection.\n *\n * @param newName New name of of the collection.\n * @param options Optional settings.\n * @param callback The results callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#rename\n */\n rename(\n newName: string,\n options: { dropTarget?: boolean },\n callback: MongoCallback<Collection<T>>,\n ): void\n\n /**\n * Replace a document on MongoDB.\n *\n * @param filter The Filter used to select the document to update.\n * @param doc The Document that replaces the matching document.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#replaceOne\n */\n replaceOne(\n filter: FilterQuery<T>,\n doc: Object,\n callback: MongoCallback<UpdateWriteOpResult>,\n ): void\n\n /**\n * Replace a document on MongoDB.\n *\n * @param filter The Filter used to select the document to update.\n * @param doc The Document that replaces the matching document.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#replaceOne\n */\n replaceOne(\n filter: FilterQuery<T>,\n doc: Object,\n options?: ReplaceOneOptions,\n ): Promise<UpdateWriteOpResult>\n\n /**\n * Replace a document on MongoDB.\n *\n * @param filter The Filter used to select the document to update.\n * @param doc The Document that replaces the matching document.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#replaceOne\n */\n replaceOne(\n filter: FilterQuery<T>,\n doc: Object,\n options: ReplaceOneOptions,\n callback: MongoCallback<UpdateWriteOpResult>,\n ): void\n\n // http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#save\n /** @deprecated Use insertOne, insertMany, updateOne or updateMany */\n save(doc: Object, callback: MongoCallback<WriteOpResult>): void\n /** @deprecated Use insertOne, insertMany, updateOne or updateMany */\n save(doc: Object, options?: CollectionOptions): Promise<WriteOpResult>\n /** @deprecated Use insertOne, insertMany, updateOne or updateMany */\n save(\n doc: Object,\n options: CollectionOptions,\n callback: MongoCallback<WriteOpResult>,\n ): void\n\n /**\n * Get all the collection statistics.\n *\n * @param callback The collection result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#stats\n */\n stats(callback: MongoCallback<CollStats>): void\n\n /**\n * Get all the collection statistics.\n *\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#stats\n */\n stats(options?: { scale: number }): Promise<CollStats>\n\n /**\n * Get all the collection statistics.\n *\n * @param options Optional settings.\n * @param callback The collection result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#stats\n */\n stats(options: { scale: number }, callback: MongoCallback<CollStats>): void\n\n // http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#update\n /** @deprecated use updateOne, updateMany or bulkWrite */\n update(\n filter: FilterQuery<T>,\n update: UpdateQuery<T>,\n callback: MongoCallback<WriteOpResult>,\n ): void\n /** @deprecated use updateOne, updateMany or bulkWrite */\n update(\n filter: FilterQuery<T>,\n update: UpdateQuery<T>,\n options?: ReplaceOneOptions & { multi?: boolean },\n ): Promise<WriteOpResult>\n /** @deprecated use updateOne, updateMany or bulkWrite */\n update(\n filter: FilterQuery<T>,\n update: UpdateQuery<T>,\n options: ReplaceOneOptions & { multi?: boolean },\n callback: MongoCallback<WriteOpResult>,\n ): void\n\n /**\n * Update multiple documents on MongoDB.\n *\n * @param filter The Filter used to select the document to update.\n * @param update The update operations to be applied to the document.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#updateMany\n */\n updateMany(\n filter: FilterQuery<T>,\n update: UpdateQuery<T>,\n callback: MongoCallback<UpdateWriteOpResult>,\n ): void\n\n /**\n * Update multiple documents on MongoDB.\n *\n * @param filter The Filter used to select the document to update.\n * @param update The update operations to be applied to the document.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#updateMany\n */\n updateMany(\n filter: FilterQuery<T>,\n update: UpdateQuery<T>,\n options?: UpdateManyOptions,\n ): Promise<UpdateWriteOpResult>\n\n /**\n * Update multiple documents on MongoDB.\n *\n * @param filter The Filter used to select the document to update.\n * @param update The update operations to be applied to the document.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#updateMany\n */\n updateMany(\n filter: FilterQuery<T>,\n update: UpdateQuery<T>,\n options: UpdateManyOptions,\n callback: MongoCallback<UpdateWriteOpResult>,\n ): void\n\n /**\n * Update a single document on MongoDB.\n *\n * @param filter The Filter used to select the document to update.\n * @param update The update operations to be applied to the document.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#updateOne\n */\n updateOne(\n filter: FilterQuery<T>,\n update: UpdateQuery<T>,\n callback: MongoCallback<UpdateWriteOpResult>,\n ): void\n\n /**\n * Update a single document on MongoDB.\n *\n * @param filter The Filter used to select the document to update.\n * @param update The update operations to be applied to the document.\n * @param options Optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#updateOne\n */\n updateOne(\n filter: FilterQuery<T>,\n update: UpdateQuery<T>,\n options?: ReplaceOneOptions,\n ): Promise<UpdateWriteOpResult>\n\n /**\n * Update a single document on MongoDB.\n *\n * @param filter The Filter used to select the document to update.\n * @param update The update operations to be applied to the document.\n * @param options Optional settings.\n * @param callback The command result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#updateOne\n */\n updateOne(\n filter: FilterQuery<T>,\n update: UpdateQuery<T>,\n options: ReplaceOneOptions,\n callback: MongoCallback<UpdateWriteOpResult>,\n ): void\n\n /**\n * Create a new Change Stream, watching for new changes (insertions, updates, replacements, deletions, and invalidations) in this collection.\n * @param pipeline An array of aggregation pipeline stages through which to pass change stream documents. This allows for filtering (using $match) and manipulating the change stream documents.\n * @param options Optional settings.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#watch\n */\n watch(\n pipeline?: Object[],\n options?: ChangeStreamOptions & {\n startAtClusterTime?: Timestamp\n session?: ClientSession\n },\n ): ChangeStream\n}\n\n/**\n * Condition.\n */\nexport type Condition<T, P extends keyof T> = {\n $eq?: T[P]\n $gt?: T[P]\n $gte?: T[P]\n $in?: T[P][]\n $lt?: T[P]\n $lte?: T[P]\n $ne?: T[P]\n $nin?: T[P][]\n $and?: (FilterQuery<T[P]> | T[P])[]\n $or?: (FilterQuery<T[P]> | T[P])[]\n $not?: (FilterQuery<T[P]> | T[P])[] | T[P]\n $expr?: any\n $jsonSchema?: any\n $mod?: [number, number]\n $regex?: RegExp\n $options?: string\n $text?: {\n $search: string\n $language?: string\n $caseSensitive?: boolean\n $diacraticSensitive?: boolean\n }\n $where?: Object\n $geoIntersects?: Object\n $geoWithin?: Object\n $near?: Object\n $nearSphere?: Object\n $elemMatch?: Object\n $size?: number\n $bitsAllClear?: Object\n $bitsAllSet?: Object\n $bitsAnyClear?: Object\n $bitsAnySet?: Object\n [key: string]: any\n}\n\n/**\n * @see https://docs.mongodb.com/manual/reference/operator/update\n */\nexport type UpdateQuery<T> = {\n $inc?: { [P in keyof T]?: number } | { [key: string]: number }\n $min?: { [P in keyof T]?: number } | { [key: string]: number }\n $max?: { [P in keyof T]?: number } | { [key: string]: number }\n $mul?: { [P in keyof T]?: number } | { [key: string]: number }\n $set?: Partial<T> | { [key: string]: any }\n $setOnInsert?: Partial<T> | { [key: string]: any }\n $unset?: { [P in keyof T]?: \"\" } | { [key: string]: \"\" }\n $rename?: { [key: string]: keyof T } | { [key: string]: string }\n $currentDate?:\n | { [P in keyof T]?: true | { $type: \"date\" | \"timestamp\" } }\n | { [key: string]: true | { $type: \"date\" | \"timestamp\" } }\n $addToSet?: Partial<T> | { [key: string]: any }\n $pop?: { [P in keyof T]?: -1 | 1 } | { [key: string]: -1 | 1 }\n $pull?: Partial<T> | { [key: string]: Condition<T, keyof T> }\n $push?: Partial<T> | { [key: string]: any }\n $pushAll?: Partial<T> | { [key: string]: Array<any> }\n $each?: Partial<T> | { [key: string]: Array<any> }\n $bit?: { [P in keyof T]?: any } | { [key: string]: any }\n}\n\nexport type FilterQuery<T> =\n | {\n [P in keyof T]?: T[P] | Condition<T, P>\n }\n | { [key: string]: any }\n\n/**\n * The name of the target collection.\n *\n * @see http://docs.mongodb.org/manual/reference/command/collStats/\n */\nexport interface CollStats {\n /**\n * Namespace.\n */\n ns: string\n\n /**\n * The number of objects or documents in this collection.\n */\n count: number\n\n /**\n * Collection size in bytes.\n */\n size: number\n\n /**\n * Average object size in bytes.\n */\n avgObjSize: number\n\n /**\n * (Pre)allocated space for the collection in bytes.\n */\n storageSize: number\n\n /**\n * Number of extents (contiguously allocated chunks of datafile space).\n */\n numExtents: number\n\n /**\n * Number of indexes.\n */\n nindexes: number\n\n /**\n * Size of the most recently created extent in bytes.\n */\n lastExtentSize: number\n\n /**\n * Padding can speed up updates if documents grow.\n */\n paddingFactor: number\n\n /**\n * A number that indicates the user-set flags on the collection. userFlags\n * only appears when using the mmapv1 storage engine.\n */\n userFlags: number\n\n /**\n * Total index size in bytes.\n */\n totalIndexSize: number\n\n /**\n * Size of specific indexes in bytes.\n */\n indexSizes: {\n _id_: number\n username: number\n }\n\n /**\n * This field will be “true” if the collection is capped.\n */\n capped: boolean\n\n /**\n * Shows the maximum size of a capped collection.\n */\n maxSize: boolean\n\n /**\n * This document contains data reported directly by the WiredTiger engine and other data for internal diagnostic use.\n */\n wiredTiger: any\n\n /**\n * A document that reports data from the WiredTiger storage engine for each index in the collection.\n * Other storage engines will return an empty document.\n */\n indexDetails: any\n\n /**\n *\n */\n ok: number\n}\n\n/**\n * CollectionAggregationOptions.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#aggregate\n */\nexport interface CollectionAggregationOptions {\n readPreference?: ReadPreference | string\n\n /**\n * Return the query as cursor, on 2.6 > it returns as a real cursor on pre 2.6 it returns as an emulated cursor.\n */\n cursor?: { batchSize: number }\n\n /**\n * Explain returns the aggregation execution plan (requires mongodb 2.6 >).\n */\n explain?: boolean\n\n /**\n * allowDiskUse lets the server know if it can use disk to store temporary results for the aggregation (requires mongodb 2.6 >).\n */\n allowDiskUse?: boolean\n\n /**\n * maxTimeMS specifies a cumulative time limit in milliseconds for processing operations on the cursor. MongoDB interrupts the operation at the earliest following interrupt point.\n */\n maxTimeMS?: boolean\n\n /**\n * Allow driver to bypass schema validation in MongoDB 3.2 or higher.\n */\n bypassDocumentValidation?: boolean\n}\n\n/**\n * CollectionInsertManyOptions.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#insertMany\n */\nexport interface CollectionInsertManyOptions {\n /**\n * The write concern.\n */\n w?: number | string\n\n /**\n * The write concern timeout.\n */\n wtimeout?: number\n\n /**\n * Specify a journal write concern.\n */\n j?: boolean\n\n /**\n * Serialize functions on any object.\n */\n serializeFunctions?: boolean\n\n /**\n * Force server to assign _id values instead of driver.\n */\n forceServerObjectId?: boolean\n}\n\nexport interface UpdateManyOptions {\n /**\n * Update operation is an upsert.\n */\n upsert?: boolean\n\n /**\n * The write concern.\n */\n w?: any\n\n /**\n * The write concern timeout.\n */\n wtimeout?: number\n\n /**\n * Specify a journal write concern.\n */\n j?: boolean\n}\n\n/**\n * CollectionBulkWriteOptions.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#bulkWrite\n */\nexport interface CollectionBulkWriteOptions {\n /**\n * The write concern.\n */\n w?: number | string\n\n /**\n * The write concern timeout.\n */\n wtimeout?: number\n\n /**\n * Specify a journal write concern.\n */\n j?: boolean\n\n /**\n * Serialize functions on any object.\n */\n serializeFunctions?: boolean\n\n /**\n * Execute write operation in ordered or unordered fashion.\n */\n ordered?: boolean\n\n /**\n * Allow driver to bypass schema validation in MongoDB 3.2 or higher.\n */\n bypassDocumentValidation?: boolean\n}\n\n/**\n * BulkWriteOpResultObject.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#~BulkWriteOpResult\n */\nexport interface BulkWriteOpResultObject {\n /**\n * Number of documents inserted.\n */\n insertedCount?: number\n\n /**\n * Number of documents matched for update.\n */\n matchedCount?: number\n\n /**\n * Number of documents modified.\n */\n modifiedCount?: number\n\n /**\n * Number of documents deleted.\n */\n deletedCount?: number\n\n /**\n * Number of documents upserted.\n */\n upsertedCount?: number\n\n /**\n * Inserted document generated Id's, hash key is the index of the originating operation.\n */\n insertedIds?: any\n\n /**\n * Upserted document generated Id's, hash key is the index of the originating operation.\n */\n upsertedIds?: any\n\n /**\n * The command result object.\n */\n result?: any\n}\n\n/**\n * MongoCountPreferences.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#count\n */\nexport interface MongoCountPreferences {\n /**\n * The limit of documents to count.\n */\n limit?: number\n\n /**\n * The number of documents to skip for the count.\n */\n skip?: boolean\n\n /**\n * An index name hint for the query.\n */\n hint?: string\n\n /**\n * The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED,\n * ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).\n */\n readPreference?: ReadPreference | string\n}\n\n/**\n * DeleteWriteOpResultObject.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#~deleteWriteOpResult\n */\nexport interface DeleteWriteOpResultObject {\n /**\n * The raw result returned from MongoDB, field will vary depending on server version.\n * @param ok Is 1 if the command executed correctly.\n * @param n The total count of documents deleted.\n */\n result: {\n ok?: number\n n?: number\n }\n\n /**\n * The connection object used for the operation.\n */\n connection?: any\n\n /**\n * The number of documents deleted.\n */\n deletedCount?: number\n}\n\n/**\n * FindAndModifyWriteOpResultObject.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#~findAndModifyWriteOpResult\n */\nexport interface FindAndModifyWriteOpResultObject {\n /**\n * Document returned from findAndModify command.\n */\n value?: any\n\n /**\n * The raw lastErrorObject returned from the command.\n */\n lastErrorObject?: any\n\n /**\n * Is 1 if the command executed correctly.\n */\n ok?: number\n}\n\n/**\n * FindOneAndReplaceOption.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#findOneAndReplace\n */\nexport interface FindOneAndReplaceOption {\n /**\n * Limits the fields to return for all matching documents.\n */\n projection?: Object\n\n /**\n * Determines which document the operation modifies if the query selects multiple documents.\n */\n sort?: Object\n\n /**\n * The maximum amount of time to allow the query to run.\n */\n maxTimeMS?: number\n\n /**\n * Upsert the document if it does not exist.\n */\n upsert?: boolean\n\n /**\n * When false, returns the updated document rather than the original. The default is true.\n */\n returnOriginal?: boolean\n}\n\n/**\n * GeoHaystackSearchOptions.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#geoHaystackSearch\n */\nexport interface GeoHaystackSearchOptions {\n /**\n * The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED,\n * ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).\n */\n readPreference?: ReadPreference | string\n\n /**\n * Include results up to maxDistance from the point.\n */\n maxDistance?: number\n\n /**\n * Filter the results by a query.\n */\n search?: Object\n\n /**\n * Max number of results to return.\n */\n limit?: number\n}\n\n/**\n * GeoNearOptions.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#geoNear\n */\nexport interface GeoNearOptions {\n /**\n * The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED,\n * ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).\n */\n readPreference?: ReadPreference | string\n\n /**\n * Max number of results to return.\n */\n num?: number\n\n /**\n * Include results starting at minDistance from a point (2.6 or higher).\n */\n minDistance?: number\n\n /**\n * Include results up to maxDistance from the point.\n */\n maxDistance?: number\n\n /**\n * Include a value to multiply the distances with allowing for range conversions.\n */\n distanceMultiplier?: number\n\n /**\n * Filter the results by a query.\n */\n query?: Object\n\n /**\n * Perform query using a spherical model.\n */\n spherical?: boolean\n\n /**\n * The closest location in a document to the center of the search region will always be returned MongoDB > 2.X.\n */\n uniqueDocs?: boolean\n\n /**\n * Include the location data fields in the top level of the results MongoDB > 2.X.\n */\n includeLocs?: boolean\n}\n\n/**\n * A class representation of the BSON Code type.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Code.html\n */\nexport declare class Code {\n /**\n *\n * @param code a string or function.\n * @param scope optional\n */\n constructor(code: string | Function, scope?: Object)\n\n /**\n * A string or function.\n */\n code: string | Function\n\n /**\n * An optional scope for the function.\n */\n scope: any\n}\n\n/**\n * CollectionOptions.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#deleteMany\n */\nexport interface CollectionOptions {\n /**\n * The write concern.\n */\n w?: number | string\n\n /**\n * The write concern timeout.\n */\n wtimeout?: number\n\n /**\n * Specify a journal write concern.\n */\n j?: boolean\n}\n\n/**\n * Create a new OrderedBulkOperation instance (INTERNAL TYPE, do not instantiate directly).\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/OrderedBulkOperation.html\n */\nexport interface OrderedBulkOperation {\n /**\n * Get the number of operations in the bulk.\n */\n length: number\n\n /**\n * Execute the ordered bulk operation.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/OrderedBulkOperation.html#execute\n */\n execute(callback: MongoCallback<BulkWriteResult>): void\n\n /**\n * Execute the ordered bulk operation.\n * @param options optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/OrderedBulkOperation.html#execute\n */\n execute(options?: FSyncOptions): Promise<BulkWriteResult>\n\n /**\n * Execute the ordered bulk operation.\n * @param options Optional settings.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/OrderedBulkOperation.html#execute\n */\n execute(\n options: FSyncOptions,\n callback: MongoCallback<BulkWriteResult>,\n ): void\n\n /**\n * Initiate a find operation for an update/updateOne/remove/removeOne/replaceOne.\n * @param selector The selector for the bulk operation.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/OrderedBulkOperation.html#find\n */\n find(selector: Object): FindOperatorsOrdered\n\n /**\n * Add a single insert document to the bulk operation.\n * @param doc The document to insert\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/OrderedBulkOperation.html#insert\n */\n insert(doc: Object): OrderedBulkOperation\n}\n\n/**\n * BulkWriteResult.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/BulkWriteResult.html\n */\nexport interface BulkWriteResult {\n /**\n * Did bulk operation correctly execute.\n */\n ok: number\n\n /**\n * number of inserted documents.\n */\n nInserted: number\n\n /**\n * number of documents updated logically.\n */\n nUpdated: number\n\n /**\n * Number of upserted documents.\n */\n nUpserted: number\n\n /**\n *\n Number of documents updated physically on disk.\n */\n nModified: number\n\n /**\n * Number of removed documents.\n */\n nRemoved: number\n\n /**\n * Return an array of inserted ids.\n */\n getInsertedIds(): Array<Object>\n\n /**\n * Retrieve lastOp if available.\n */\n getLastOp(): Object\n\n /**\n * Return raw internal result.\n */\n getRawResponse(): Object\n\n /**\n * Return the upserted id at position x.\n */\n getUpsertedIdAt(index: number): Object\n\n /**\n * Return an array of upserted ids.\n */\n getUpsertedIds(): Array<{ _id: string; index: number }>\n\n /**\n * Retrieve the write concern error if any.\n */\n getWriteConcernError(): WriteConcernError\n\n /**\n * Returns a specific write error object.\n */\n getWriteErrorAt(index: number): WriteError\n\n /**\n * Returns the number of write errors off the bulk operation.\n */\n getWriteErrorCount(): number\n\n /**\n * Retrieve all write errors.\n */\n getWriteErrors(): Array<Object>\n\n /**\n * Returns true if the bulk operation contains a write error.\n */\n hasWriteErrors(): boolean\n}\n\n/**\n * Create a new WriteError instance (INTERNAL TYPE, do not instantiate directly).\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/WriteError.html\n */\nexport interface WriteError {\n /**\n * Write concern error code.\n */\n code: number\n\n /**\n * Write concern error original bulk operation index.\n */\n index: number\n\n /**\n * Write concern error message.\n */\n errmsg: string\n}\n\n/**\n * Create a new WriteConcernError instance (INTERNAL TYPE, do not instantiate directly).\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/WriteConcernError.html\n */\nexport interface WriteConcernError {\n /**\n * Write concern error code.\n */\n code: number\n\n /**\n * Write concern error message.\n */\n errmsg: string\n}\n\n/**\n * Create a FindOperatorsOrdered instance (INTERNAL TYPE, do not instantiate directly).\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/FindOperatorsOrdered.html\n */\nexport interface FindOperatorsOrdered {\n /**\n * Add a remove operation to the bulk operation.\n */\n delete(): OrderedBulkOperation\n\n /**\n * Add a remove one operation to the bulk operation.\n */\n deleteOne(): OrderedBulkOperation\n\n /**\n * Add a replace one operation to the bulk operation.\n */\n replaceOne(doc: Object): OrderedBulkOperation\n\n /**\n * Add a single update document to the bulk operation.\n */\n update(doc: Object): OrderedBulkOperation\n\n /**\n * Add a single update one document to the bulk operation.\n */\n updateOne(doc: Object): OrderedBulkOperation\n\n /**\n * Upsert modifier for update bulk operation.\n */\n upsert(): FindOperatorsOrdered\n}\n\n/**\n * Create a new UnorderedBulkOperation instance (INTERNAL TYPE, do not instantiate directly).\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/UnorderedBulkOperation.html\n */\nexport interface UnorderedBulkOperation {\n /**\n * Get the number of operations in the bulk.\n */\n length: number\n\n /**\n * Execute the ordered bulk operation.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/UnorderedBulkOperation.html#execute\n */\n execute(callback: MongoCallback<BulkWriteResult>): void\n\n /**\n * Execute the ordered bulk operation.\n * @param options optional.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/UnorderedBulkOperation.html#execute\n */\n execute(options?: FSyncOptions): Promise<BulkWriteResult>\n\n /**\n * Execute the ordered bulk operation.\n * @param options Optional settings.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/UnorderedBulkOperation.html#execute\n */\n execute(\n options: FSyncOptions,\n callback: MongoCallback<BulkWriteResult>,\n ): void\n\n /**\n * Initiate a find operation for an update/updateOne/remove/removeOne/replaceOne.\n * @param selector The selector for the bulk operation.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/UnorderedBulkOperation.html#find\n */\n find(selector: Object): FindOperatorsUnordered\n\n /**\n * Add a single insert document to the bulk operation.\n * @param doc The document to insert.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/UnorderedBulkOperation.html#insert\n */\n insert(doc: Object): UnorderedBulkOperation\n}\n\n/**\n * Create a FindOperatorsUnordered instance (INTERNAL TYPE, do not instantiate directly).\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/FindOperatorsUnordered.html\n */\nexport interface FindOperatorsUnordered {\n /**\n * Get the number of operations in the bulk.\n */\n length: number\n\n /**\n * Add a remove operation to the bulk operation.\n */\n remove(): UnorderedBulkOperation\n\n /**\n * Add a remove one operation to the bulk operation.\n */\n removeOne(): UnorderedBulkOperation\n\n /**\n * Add a replace one operation to the bulk operation.\n * @param doc The new document to replace the existing one with.\n */\n replaceOne(doc: Object): UnorderedBulkOperation\n\n /**\n * Add a single update document to the bulk operation.\n * @param doc Update operations\n */\n update(doc: Object): UnorderedBulkOperation\n\n /**\n * Add a single update one document to the bulk operation.\n * @param doc Update operations\n */\n updateOne(doc: Object): UnorderedBulkOperation\n\n /**\n * Upsert modifier for update bulk operation.\n */\n upsert(): FindOperatorsUnordered\n}\n\n/**\n * MongodbFindOneOptions.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#findOne\n */\nexport interface MongodbFindOneOptions {\n /**\n * Sets the limit of documents returned in the query.\n */\n limit?: number\n\n /**\n * Set to sort the documents coming back from the query. Array of indexes, [['a', 1]] etc.\n */\n sort?: Array<any> | Object\n\n /**\n * The fields to return in the query. Object of fields to include or exclude (not both), {'a':1}.\n */\n fields?: Object\n\n /**\n * Set to skip N documents ahead in your query (useful for pagination).\n */\n skip?: number\n\n /**\n * Tell the query to use specific indexes in the query. Object of indexes to use, {'_id':1}.\n */\n hint?: Object\n\n /**\n * Explain the query instead of returning the data.\n */\n explain?: boolean\n\n /**\n * Snapshot query.\n */\n snapshot?: boolean\n\n /**\n * Specify if the cursor can timeout.\n */\n timeout?: boolean\n\n /**\n * Specify if the cursor is tailable.\n */\n tailable?: boolean\n\n /**\n * Set the batchSize for the getMoreCommand when iterating over the query results.\n */\n batchSize?: number\n\n /**\n * Only return the index key.\n */\n returnKey?: boolean\n\n /**\n * Limit the number of items to scan.\n */\n maxScan?: number\n\n /**\n * Set index bounds.\n */\n min?: number\n\n /**\n * Set index bounds.\n */\n max?: number\n\n /**\n * Show disk location of results.\n */\n showDiskLoc?: boolean\n\n /**\n * You can put a $comment field on a query to make looking in the profiler logs simpler.\n */\n comment?: string\n\n /**\n * Return document results as raw BSON buffers.\n */\n raw?: boolean\n\n /**\n * The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED,\n * ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).\n */\n readPreference?: ReadPreference | string\n\n /**\n * Specify if the cursor should return partial results when querying against a sharded system.\n */\n partial?: boolean\n\n /**\n * Number of milliseconds to wait before aborting the query.\n */\n maxTimeMs?: number\n}\n\n/**\n * InsertWriteOpResult.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#~insertWriteOpResult\n */\nexport interface InsertWriteOpResult {\n /**\n * The total amount of documents inserted.\n */\n insertedCount: number\n\n /**\n * All the documents inserted using insertOne/insertMany/replaceOne.\n * Documents contain the _id field if forceServerObjectId == false for insertOne/insertMany.\n */\n ops: Array<any>\n\n /**\n * All the generated _id's for the inserted documents.\n */\n insertedIds: Array<ObjectID>\n\n /**\n * The connection object used for the operation.\n */\n connection: any\n\n /**\n * The raw command result object returned from MongoDB (content might vary by server version).\n * @param ok Is 1 if the command executed correctly.\n * @param n The total count of documents inserted.\n */\n result: { ok: number; n: number }\n}\n\n/**\n * CollectionInsertOneOptions.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#insertOne\n */\nexport interface CollectionInsertOneOptions {\n /**\n * The write concern.\n */\n w?: number | string\n\n /**\n * The write concern timeout.\n */\n wtimeout?: number\n\n /**\n * Specify a journal write concern.\n */\n j?: boolean\n\n /**\n * Serialize functions on any object.\n */\n serializeFunctions?: boolean\n\n /**\n * Force server to assign _id values instead of driver.\n */\n forceServerObjectId?: boolean\n\n /**\n * Allow driver to bypass schema validation in MongoDB 3.2 or higher.\n */\n bypassDocumentValidation?: boolean\n}\n\n/**\n * InsertOneWriteOpResult.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#~insertOneWriteOpResult\n */\nexport interface InsertOneWriteOpResult {\n /**\n * The total amount of documents inserted.\n */\n insertedCount: number\n\n /**\n * All the documents inserted using insertOne/insertMany/replaceOne.\n * Documents contain the _id field if forceServerObjectId == false for insertOne/insertMany.\n */\n ops: Array<any>\n\n /**\n * The driver generated ObjectId for the insert operation.\n */\n insertedId: ObjectID\n\n /**\n * The connection object used for the operation.\n */\n connection: any\n\n /**\n * The raw command result object returned from MongoDB (content might vary by server version).\n * @param ok Is 1 if the command executed correctly.\n * @param n The total count of documents inserted.\n */\n result: { ok: number; n: number }\n}\n\n/**\n * ParallelCollectionScanOptions.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#parallelCollectionScan\n */\nexport interface ParallelCollectionScanOptions {\n /**\n * The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED,\n * ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).\n */\n readPreference?: ReadPreference | string\n\n /**\n * Set the batchSize for the getMoreCommand when iterating over the query results.\n */\n batchSize?: number\n\n /**\n * The maximum number of parallel command cursors to return (the number of returned cursors will be in the range 1:numCursors).\n */\n numCursors?: number\n\n /**\n * Return all BSON documents as Raw Buffer documents.\n */\n raw?: boolean\n}\n\n/**\n * ParallelCollectionScanOptions.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#replaceOne\n */\nexport interface ReplaceOneOptions {\n /**\n * Update operation is an upsert.\n */\n upsert?: boolean\n\n /**\n * The write concern.\n */\n w?: number | string\n\n /**\n * The write concern timeout.\n */\n wtimeout?: number\n\n /**\n * Specify a journal write concern.\n */\n j?: boolean\n\n /**\n * Allow driver to bypass schema validation in MongoDB 3.2 or higher.\n */\n bypassDocumentValidation?: boolean\n}\n\n/**\n * ParallelCollectionScanOptions.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#~updateWriteOpResult\n */\nexport interface UpdateWriteOpResult {\n /**\n * The raw result returned from MongoDB, field will vary depending on server version.\n * @param ok Is 1 if the command executed correctly.\n * @param n The total count of documents scanned.\n * @param nModified The total count of documents modified.\n */\n result: { ok: number; n: number; nModified: number }\n\n /**\n * The connection object used for the operation.\n */\n connection: any\n\n /**\n * The number of documents that matched the filter.\n */\n matchedCount: number\n\n /**\n * The number of documents that were modified.\n */\n modifiedCount: number\n\n /**\n * The number of documents upserted.\n */\n upsertedCount: number\n\n /**\n * The upserted id.\n * @param _id The upserted _id returned from the server.\n */\n upsertedId: { _id: ObjectID }\n}\n\n/**\n * ParallelCollectionScanOptions.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#mapReduce\n */\nexport interface MapReduceOptions {\n /**\n * The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED,\n * ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).\n */\n readPreference?: ReadPreference | string\n\n /**\n * Sets the output target for the map reduce job.\n * {inline:1} | {replace:'collectionName'} | {merge:'collectionName'} | {reduce:'collectionName'}.\n */\n out?: Object\n\n /**\n * Query filter object.\n */\n query?: Object\n\n /**\n * Sorts the input objects using this key. Useful for optimization, like sorting by the emit key for fewer reduces.\n */\n sort?: Object\n\n /**\n * Number of objects to return from collection.\n */\n limit?: number\n\n /**\n * Keep temporary data.\n */\n keeptemp?: boolean\n\n /**\n * Finalize function.\n */\n finalize?: Function | string\n\n /**\n * Can pass in variables that can be access from map/reduce/finalize.\n */\n scope?: Object\n\n /**\n * It is possible to make the execution stay in JS. Provided in MongoDB > 2.0.X.\n */\n jsMode?: boolean\n\n /**\n * Provide statistics on job execution time.\n */\n verbose?: boolean\n\n /**\n * Allow driver to bypass schema validation in MongoDB 3.2 or higher.\n */\n bypassDocumentValidation?: boolean\n}\n\n/**\n * WriteOpResult.\n *\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#~WriteOpResult\n */\nexport interface WriteOpResult {\n /**\n * All the documents inserted using insertOne/insertMany/replaceOne.\n * Documents contain the _id field if forceServerObjectId == false for insertOne/insertMany.\n */\n ops: Array<any>\n\n /**\n * The connection object used for the operation.\n */\n connection: any\n\n /**\n * The command result object.\n */\n result: any\n}\n\n/**\n * WriteOpResult.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#~resultCallback\n */\nexport type CursorResult = any | void | boolean\n\n/**\n * Creates a new Cursor instance (INTERNAL TYPE, do not instantiate directly).\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html\n */\nexport declare class Cursor<T> extends Readable {\n [Symbol.asyncIterator](): AsyncIterableIterator<T>\n\n /**\n * Cursor query sort setting.\n */\n sortValue: string\n\n /**\n * Is Cursor able to time out.\n */\n timeout: boolean\n\n /**\n * Get cursor ReadPreference.\n */\n readPreference: ReadPreference\n\n /**\n * @param flag The flag to set, must be one of following ['tailable', 'oplogReplay', 'noCursorTimeout', 'awaitData', 'partial'].\n * @param value The flag boolean value.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#addCursorFlag\n */\n addCursorFlag(flag: string, value: boolean): Cursor<T>\n\n /**\n * @param name The query modifier (must start with $, such as $orderby etc).\n * @param value The flag boolean value.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#addQueryModifier\n */\n addQueryModifier(name: string, value: boolean): Cursor<T>\n\n /**\n * @param value The batchSize for the cursor.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#batchSize\n */\n batchSize(value: number): Cursor<T>\n\n /**\n * Clone the cursor.\n * still returns the same type.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#clone\n */\n clone(): Cursor<T>\n\n /**\n * Close the cursor, sending a KillCursor command and emitting close.\n * The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#close\n */\n close(): Promise<CursorResult>\n\n /**\n * Close the cursor, sending a KillCursor command and emitting close.\n * The result callback.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#close\n */\n close(callback: MongoCallback<CursorResult>): void\n\n /**\n * Add a comment to the cursor query allowing for tracking the comment in the log.\n * @param value The comment attached to this query.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#comment\n */\n comment(value: string): Cursor<T>\n\n /**\n * Get the count of documents for this cursor.\n * @param applySkipLimit Should the count command apply limit and skip settings on the cursor or in the passed in options.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#count\n */\n count(applySkipLimit: boolean, callback: MongoCallback<number>): void\n\n /**\n * Get the count of documents for this cursor.\n * @param applySkipLimit Should the count command apply limit and skip settings on the cursor or in the passed in options.\n * @param options Optional settings.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#count\n */\n count(\n applySkipLimit: boolean,\n options?: CursorCommentOptions,\n ): Promise<number>\n\n /**\n * Get the count of documents for this cursor.\n * @param applySkipLimit Should the count command apply limit and skip settings on the cursor or in the passed in options.\n * @param options Optional settings.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#count\n */\n count(\n applySkipLimit: boolean,\n options: CursorCommentOptions,\n callback: MongoCallback<number>,\n ): void\n\n /**\n * Execute the explain for the cursor.\n * returns Promise if no callback passed.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#explain\n */\n explain(): Promise<CursorResult>\n\n /**\n * Execute the explain for the cursor.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#explain\n */\n explain(callback: MongoCallback<CursorResult>): void\n\n /**\n * Set the cursor query.\n * @param filter The filter object used for the cursor.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#filter\n */\n filter(filter: Object): Cursor<T>\n\n /**\n * Iterates over all the documents for this cursor using the iterator, callback pattern.\n * @param iterator The iteration callback.\n * @param callback The end callback.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#forEach\n */\n forEach(iterator: IteratorCallback<T>, callback: EndCallback): void\n forEach(iterator: IteratorCallback<T>): Promise<void>\n\n /**\n * Check if there is any document still available in the cursor.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#hasNext\n */\n hasNext(): Promise<boolean>\n\n /**\n * Check if there is any document still available in the cursor.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#hasNext\n */\n hasNext(callback: MongoCallback<boolean>): void\n\n /**\n * Set the cursor hint.\n * @param hint If specified, then the query system will only consider plans using the hinted index.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#hint\n */\n hint(hint: Object): Cursor<T>\n\n /**\n * Is the cursor closed.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#isClosed\n */\n isClosed(): boolean\n\n /**\n * Set the limit for the cursor.\n * @param value The limit for the cursor query.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#limit\n */\n limit(value: number): Cursor<T>\n\n /**\n * SMap all documents using the provided function.\n * @param transform The mapping transformation method.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#map\n */\n map(transform: Function): Cursor<T>\n\n /**\n * Set the cursor max.\n * @param max Specify a $max value to specify the exclusive upper bound for a specific index in\n * order to constrain the results of find(). The $max specifies the upper bound for\n * all keys of a specific index in order.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#max\n */\n max(max: number): Cursor<T>\n\n /**\n * Set a maxAwaitTimeMS on a tailing cursor query to allow to customize the\n * timeout value for the option awaitData (Only supported on MongoDB 3.2 or higher, ignored otherwise).\n * @param value Number of milliseconds to wait before aborting the tailed query.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#maxAwaitTimeMS\n */\n maxAwaitTimeMS(value: number): Cursor<T>\n\n /**\n * Set the cursor maxScan.\n * @param maxScan Constrains the query to only scan the specified number of documents when fulfilling the query.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#maxScan\n */\n maxScan(maxScan: Object): Cursor<T>\n\n /**\n * Set a maxTimeMS on the cursor query, allowing for hard timeout limits on queries (Only supported on MongoDB 2.6 or higher).\n * @param value Number of milliseconds to wait before aborting the query.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#maxTimeMS\n */\n maxTimeMS(value: number): Cursor<T>\n\n /**\n * Set the cursor min.\n * @param min Specify a $min value to specify the inclusive lower bound for a specific index in order to\n * constrain the results of find(). The $min specifies the lower bound for all keys of a specific index in order.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#min\n */\n min(min: number): Cursor<T>\n\n /**\n * Get the next available document from the cursor, returns null if no more documents are available.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#next\n */\n next(): Promise<CursorResult>\n\n /**\n * Get the next available document from the cursor, returns null if no more documents are available.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#next\n */\n next(callback: MongoCallback<CursorResult>): void\n\n /**\n * Sets a field projection for the query.\n * @param value The field projection object.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#project\n */\n project(value: Object): Cursor<T>\n\n /**\n * The read() method pulls some data out of the internal buffer and returns it.\n * If there is no data available, then it will return null.\n * @param size Optional argument to specify how much data to read.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#read\n */\n read(size: number): string | Buffer | void\n\n /**\n * Set the cursor returnKey.\n * @param returnKey Only return the index field or fields for the results of the query. If $returnKey is set\n * to true and the query does not use an index to perform the read operation,\n * the returned documents will not contain any fields. Use one of the following forms:\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#next\n */\n returnKey(returnKey: Object): Cursor<T>\n\n /**\n * Resets the cursor.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#rewind\n */\n rewind(): void\n\n /**\n * Set a node.js specific cursor option.\n * @param field The cursor option to set ['numberOfRetries', 'tailableRetryInterval'].\n * @param value The field value.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#setCursorOption\n */\n setCursorOption(field: string, value: Object): Cursor<T>\n\n /**\n * Set the ReadPreference for the cursor.\n * @param readPreference The new read preference for the cursor.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#setReadPreference\n */\n setReadPreference(readPreference: string | ReadPreference): Cursor<T>\n\n /**\n * Set the cursor showRecordId.\n * @param showRecordId The $showDiskLoc option has now been deprecated and replaced with the\n * showRecordId field. $showDiskLoc will still be accepted for OP_QUERY stye find.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#showRecordId\n */\n showRecordId(showRecordId: Object): Cursor<T>\n\n /**\n * Set the skip for the cursor.\n * @param value The skip for the cursor query.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#skip\n */\n skip(value: number): Cursor<T>\n\n /**\n * Set the cursor snapshot.\n * @param snapshot The $snapshot operator prevents the cursor from returning a document more than\n * once because an intervening write operation results in a move of the document.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#snapshot\n */\n snapshot(snapshot: Object): Cursor<T>\n\n /**\n * Sets the sort order of the cursor query.\n * @param keyOrList The key or keys set for the sort.\n * @param direction The direction of the sorting (1 or -1).\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#sort\n */\n sort(keyOrList: string | Object[] | Object, direction?: number): Cursor<T>\n\n /**\n * Return a modified Readable stream including a possible transform method.\n * @param options Optional settings.\n * @param transform A transformation method applied to each document emitted by the stream.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#stream\n */\n stream(options?: { transform?: Function }): Cursor<T>\n\n /**\n * Returns an array of documents. The caller is responsible for making sure that there is enough\n * memory to store the results. Note that the array only contain partial results when this cursor had\n * been previously accessed. In that case, cursor.rewind() can be used to reset the cursor.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#toArray\n */\n toArray(): Promise<T[]>\n\n /**\n * Returns an array of documents. The caller is responsible for making sure that there is enough\n * memory to store the results. Note that the array only contain partial results when this cursor had\n * been previously accessed. In that case, cursor.rewind() can be used to reset the cursor.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#toArray\n */\n toArray(callback: MongoCallback<T[]>): void\n\n /**\n * This is useful in certain cases where a stream is being consumed by a parser, which needs to \"un-consume\" some\n * data that it has optimistically pulled out of the source, so that the stream can be passed on to some other party.\n * @param stream Chunk of data to unshift onto the read queue.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#unshift\n */\n unshift(stream: Buffer | string): void\n}\n\n/**\n * Get the count of documents for this cursor.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#count\n */\nexport interface CursorCommentOptions {\n /**\n * The number of documents to skip.\n */\n skip?: number\n\n /**\n * The maximum amounts to count before aborting.\n */\n limit?: number\n\n /**\n * Number of miliseconds to wait before aborting the query.\n */\n maxTimeMS?: number\n\n /**\n * An index name hint for the query.\n */\n hint?: string\n\n /**\n * The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED,\n * ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).\n */\n readPreference?: ReadPreference | string\n}\n\n/**\n * Creates a new Change Stream instance.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/ChangeStream.html\n */\nexport declare class ChangeStream extends Readable {\n constructor(\n changeDomain: MongoClient | Db | Collection<any>,\n pipeline: Object[],\n options?: ChangeStreamOptions,\n )\n\n /**\n * Close the Change Stream.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/ChangeStream.html#close\n */\n close(): Promise<any>\n\n /**\n * Close the Change Stream.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/ChangeStream.html#close\n */\n close(callback: MongoCallback<any>): void\n\n /**\n * Check if there is any document still available in the Change Stream.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/ChangeStream.html#hasNext\n */\n hasNext(): Promise<any>\n\n /**\n * Check if there is any document still available in the Change Stream.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/ChangeStream.html#hasNext\n */\n hasNext(callback: MongoCallback<any>): void\n\n /**\n * Is the cursor closed.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/ChangeStream.html#isClosed\n */\n isClosed(): boolean\n\n /**\n * Get the next available document from the Change Stream, returns null if no more documents are available.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/ChangeStream.html#next\n */\n next(): Promise<any>\n\n /**\n * Get the next available document from the Change Stream, returns null if no more documents are available.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/ChangeStream.html#next\n */\n next(callback: MongoCallback<any>): void\n\n /**\n * Return a modified Readable stream including a possible transform method.\n * @param options Optional settings.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/ChangeStream.html#stream\n */\n stream(options?: { transform: Function }): Cursor<any>\n}\n\n/**\n * ChangeStreamOptions\n */\nexport interface ChangeStreamOptions {\n /**\n * Allowed values: ‘default’, ‘updateLookup’.\n * When set to ‘updateLookup’, the change stream will include both a delta describing the changes to the document,\n * as well as a copy of the entire document that was changed from some time after the change occurred.\n */\n fullDocument?: string\n\n /**\n * The maximum amount of time for the server to wait on new documents to satisfy a change stream query\n */\n maxAwaitTimeMS?: number\n\n /**\n * Specifies the logical starting point for the new change stream.\n * This should be the _id field from a previously returned change stream document.\n */\n resumeAfter?: Object\n\n /**\n * The number of documents to return per batch.\n */\n batchSize?: number\n\n /**\n * Specify collation settings for operation.\n */\n collation?: CollationDocument\n\n /**\n * The read preference. Defaults to the read preference of the database or collection.\n */\n readPreference?: ReadPreference\n}\n\n/**\n * CollationDocument\n */\nexport interface CollationDocument {\n locale: string\n strength?: number\n caseLevel?: boolean\n caseFirst?: string\n numericOrdering?: boolean\n alternate?: string\n maxVariable?: string\n backwards?: boolean\n normalization?: boolean\n}\n\n/**\n * A class representing a client session on the server.\n * WARNING: not meant to be instantiated directly.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/ClientSession.html\n */\nexport interface ClientSession extends EventEmitter {\n /**\n * The server id associated with this session\n */\n id: any\n\n /**\n * Aborts the currently active transaction in this session.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/ClientSession.html#abortTransaction\n */\n abortTransaction(): Promise<void>\n\n /**\n * Aborts the currently active transaction in this session.\n * @param callback Optional callback for completion of this operation\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/ClientSession.html#abortTransaction\n */\n abortTransaction(callback?: MongoCallback<void>): Promise<void>\n\n /**\n * Advances the operationTime for a ClientSession.\n * @param operationTime the BSON.Timestamp of the operation type it is desired to advance to.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/ClientSession.html#advanceOperationTime\n */\n advanceOperationTime(operationTime: Timestamp): void\n\n /**\n * Commits the currently active transaction in this session.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/ClientSession.html#commitTransaction\n */\n commitTransaction(): Promise<void>\n\n /**\n * Commits the currently active transaction in this session.\n * @param callback Optional callback for completion of this operation.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/ClientSession.html#commitTransaction\n */\n commitTransaction(callback?: MongoCallback<void>): Promise<void>\n\n /**\n * Ends this session on the server.\n * @param callback Optional callback for completion of this operation.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/ClientSession.html#endSession\n */\n endSession(callback?: MongoCallback<void>): void\n\n /**\n * Ends this session on the server.\n * @param options Optional settings. Currently reserved for future use.\n * @param callback Optional callback for completion of this operation.\n * @see @see http://mongodb.github.io/node-mongodb-native/3.1/api/ClientSession.html#endSession\n */\n endSession(options?: any, callback?: MongoCallback<void>): void\n\n /**\n * Used to determine if this session equals another.\n * @param session A class representing a client session on the server.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/ClientSession.html#equals\n */\n equals(session: ClientSession): boolean\n\n /**\n * Increment the transaction number on the internal ServerSession.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/ClientSession.html#incrementTransactionNumber\n */\n incrementTransactionNumber(): void\n\n /**\n * Check this session is currently in a transaction or not.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/ClientSession.html#inTransaction\n */\n inTransaction(): boolean\n\n /**\n * Starts a new transaction with the given options.\n * @param options Optional settings.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/ClientSession.html#startTransaction\n */\n startTransaction(options?: TransactionOptions): void\n}\n\n/**\n * Options to pass when creating a Client Session\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/global.html#SessionOptions\n */\nexport interface SessionOptions {\n /**\n * Whether causal consistency should be enabled on this session\n */\n causalConsistency?: boolean\n\n /**\n * The default TransactionOptions to use for transactions started on this session.\n */\n defaultTransactionOptions?: TransactionOptions\n}\n\n/**\n * TransactionOptions\n */\nexport interface TransactionOptions {\n readConcern?: ReadConcern\n writeConcern?: WriteConcern\n readPreference?: ReadPreference\n}\n\n/**\n * MongoClientCommonOption\n */\nexport interface MongoClientCommonOption {\n /**\n * Do not make the db an event listener to the original connection.\n */\n noListener?: boolean\n\n /**\n * Control if you want to return a cached instance or have a new one created\n */\n returnNonCachedInstance?: boolean\n}\n\n/**\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/global.html#ReadConcern\n */\nexport type ReadConcernLevel =\n | \"local\"\n | \"available\"\n | \"majority\"\n | \"linearizable\"\n | \"snapshot\"\n\n/**\n * The MongoDB ReadConcern, which allows for control of the consistency and isolation properties\n * of the data read from replica sets and replica set shards.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/global.html#ReadConcern\n */\nexport interface ReadConcern {\n level?: ReadConcernLevel\n}\n\n/**\n * A MongoDB WriteConcern, which describes the level of acknowledgement\n * requested from MongoDB for write operations.\n * @see http://mongodb.github.io/node-mongodb-native/3.1/api/global.html#WriteConcern\n */\nexport interface WriteConcern {\n /**\n * requests acknowledgement that the write operation has\n * propagated to a specified number of mongod hosts\n */\n w?: number | \"majority\" | string\n\n /**\n * requests acknowledgement from MongoDB that the write operation has\n * been written to the journal\n */\n j?: boolean\n\n /**\n * a time limit, in milliseconds, for the write concern\n */\n wtimeout?: number\n}\n\n/**\n * The callback format for the forEach iterator method.\n * @param doc An emitted document for the iterator.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#~iteratorCallback\n */\nexport interface IteratorCallback<T> {\n (doc: T): void\n}\n\n/**\n * The callback error format for the forEach iterator method.\n * @param error An error instance representing the error during the execution.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#~endCallback\n */\nexport interface EndCallback {\n (error: MongoError): void\n}\n\n/**\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#~resultCallback\n */\nexport type AggregationCursorResult = any | void\n\n/**\n * Creates a new Aggregation Cursor instance (INTERNAL TYPE, do not instantiate directly),\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html\n */\nexport interface AggregationCursor<T> extends Readable {\n /**\n * Set the batch size for the cursor.\n * @param value The batchSize for the cursor.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#batchSize\n */\n batchSize(value: number): AggregationCursor<T>\n\n /**\n * Clone the cursor.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#clone\n */\n clone(): AggregationCursor<T>\n\n /**\n * Close the cursor, sending a AggregationCursor command and emitting close.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#close\n */\n close(): Promise<AggregationCursorResult>\n\n /**\n * Close the cursor, sending a AggregationCursor command and emitting close.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#close\n */\n close(callback: MongoCallback<AggregationCursorResult>): void\n\n /**\n * Iterates over all the documents for this cursor. As with {cursor.toArray}, not all of the elements will\n * be iterated if this cursor had been previously accessed. In that case, {cursor.rewind} can be used to reset\n * the cursor. However, unlike {cursor.toArray}, the cursor will only hold a maximum of batch size elements\n * at any given time if batch size is specified. Otherwise, the caller is responsible for making sure\n * that the entire result can fit the memory.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#each\n */\n each(callback: MongoCallback<AggregationCursorResult>): void\n\n /**\n * Execute the explain for the cursor.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#explain\n */\n explain(): Promise<AggregationCursorResult>\n\n /**\n * Execute the explain for the cursor.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#explain\n */\n explain(callback: MongoCallback<AggregationCursorResult>): void\n\n /**\n * Add a geoNear stage to the aggregation pipeline.\n * @param document The geoNear stage document.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#geoNear\n */\n geoNear(document: Object): AggregationCursor<T>\n\n /**\n * Add a group stage to the aggregation pipeline.\n * @param document The group stage document.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#group\n */\n group(document: Object): AggregationCursor<T>\n\n /**\n * Is the cursor closed.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#isClosed\n */\n isClosed(): boolean\n\n /**\n * Add a limit stage to the aggregation pipeline.\n * @param value The state limit value.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#limit\n */\n limit(value: number): AggregationCursor<T>\n\n /**\n * Add a match stage to the aggregation pipeline.\n * @param document The match stage document.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#match\n */\n match(document: Object): AggregationCursor<T>\n\n /**\n * Add a maxTimeMS stage to the aggregation pipeline.\n * @param value The state maxTimeMS value.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#maxTimeMS\n */\n maxTimeMS(value: number): AggregationCursor<T>\n\n /**\n * Get the next available document from the cursor, returns null if no more documents are available.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#next\n */\n next(): Promise<AggregationCursorResult>\n\n /**\n * Get the next available document from the cursor, returns null if no more documents are available.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#next\n */\n next(callback: MongoCallback<AggregationCursorResult>): void\n\n /**\n * Add a out stage to the aggregation pipeline.\n * @param destination The destination name.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#out\n */\n out(destination: string): AggregationCursor<T>\n\n /**\n * Add a project stage to the aggregation pipeline.\n * @param document The project stage document.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#project\n */\n project(document: Object): AggregationCursor<T>\n\n /**\n * The read() method pulls some data out of the internal buffer and returns it.\n * If there is no data available, then it will return null.\n * @param size Optional argument to specify how much data to read.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#read\n */\n read(size: number): string | Buffer | void\n\n /**\n * Add a redact stage to the aggregation pipeline.\n * @param document The redact stage document.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#redact\n */\n redact(document: Object): AggregationCursor<T>\n\n /**\n * Resets the cursor.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#rewind\n */\n rewind(): AggregationCursor<T>\n\n /**\n * Add a skip stage to the aggregation pipeline.\n * @param value The state skip value.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#setEncoding\n */\n skip(value: number): AggregationCursor<T>\n\n /**\n * Add a sort stage to the aggregation pipeline.\n * @param document The sort stage document.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#sort\n */\n sort(document: Object): AggregationCursor<T>\n\n /**\n * Returns an array of documents. The caller is responsible for making sure that there\n * is enough memory to store the results. Note that the array only contain partial\n * results when this cursor had been previously accessed. In that case,\n * cursor.rewind() can be used to reset the cursor.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#toArray\n */\n toArray(): Promise<T[]>\n\n /**\n * Returns an array of documents. The caller is responsible for making sure that there\n * is enough memory to store the results. Note that the array only contain partial\n * results when this cursor had been previously accessed. In that case,\n * cursor.rewind() can be used to reset the cursor.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#toArray\n */\n toArray(callback: MongoCallback<T[]>): void\n\n /**\n * This is useful in certain cases where a stream is being consumed by a parser,\n * which needs to \"un-consume\" some data that it has optimistically pulled out of the source,\n * so that the stream can be passed on to some other party.\n * @param stream Chunk of data to unshift onto the read queue.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#unshift\n */\n unshift(stream: Buffer | string): void\n\n /**\n * Add a unwind stage to the aggregation pipeline.\n * @param field The unwind field name.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#unwind\n */\n unwind(field: string): AggregationCursor<T>\n}\n\n/**\n * CommandCursor.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html\n */\nexport interface CommandCursor extends Readable {\n /**\n * Set the batch size for the cursor.\n * @param value The batchSize for the cursor.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#batchSize\n */\n batchSize(value: number): CommandCursor\n\n /**\n * Clone the cursor.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#clone\n */\n clone(): CommandCursor\n\n /**\n * Close the cursor, sending a KillCursor command and emitting close.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#close\n */\n close(): Promise<AggregationCursorResult>\n\n /**\n * Close the cursor, sending a KillCursor command and emitting close.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#close\n */\n close(callback: MongoCallback<AggregationCursorResult>): void\n\n /**\n * Each\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#each\n */\n each(callback: MongoCallback<AggregationCursorResult>): void\n\n /**\n * Is the cursor closed.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#isClosed\n */\n isClosed(): boolean\n\n /**\n * Add a maxTimeMS stage to the aggregation pipeline.\n * @param value The state maxTimeMS value.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#maxTimeMS\n */\n maxTimeMS(value: number): CommandCursor\n\n /**\n * Get the next available document from the cursor, returns null if no more documents are available.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#next\n */\n next(): Promise<AggregationCursorResult>\n\n /**\n * Get the next available document from the cursor, returns null if no more documents are available.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#next\n */\n next(callback: MongoCallback<AggregationCursorResult>): void\n\n /**\n * The read() method pulls some data out of the internal buffer and returns it.\n * If there is no data available, then it will return null.\n * @param size Optional argument to specify how much data to read.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#read\n */\n read(size: number): string | Buffer | void\n\n /**\n * Resets the cursor.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#rewind\n */\n rewind(): CommandCursor\n\n /**\n * Set the ReadPreference for the cursor.\n * @param readPreference The new read preference for the cursor.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#setReadPreference\n */\n setReadPreference(readPreference: string | ReadPreference): CommandCursor\n\n /**\n * Returns an array of documents. The caller is responsible for making sure that there is enough memory\n * to store the results. Note that the array only contain partial results when this cursor had been previously accessed.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#toArray\n */\n toArray(): Promise<any[]>\n\n /**\n * Returns an array of documents. The caller is responsible for making sure that there is enough memory\n * to store the results. Note that the array only contain partial results when this cursor had been previously accessed.\n * @param callback The result callback.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#toArray\n */\n toArray(callback: MongoCallback<any[]>): void\n\n /**\n * This is useful in certain cases where a stream is being consumed by a parser,\n * which needs to \"un-consume\" some data that it has optimistically pulled out of the source,\n * so that the stream can be passed on to some other party.\n * @param stream Chunk of data to unshift onto the read queue.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#unshift\n */\n unshift(stream: Buffer | string): void\n}\n\n/**\n * GridFSBucket.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucket.html\n */\nexport declare class GridFSBucket {\n /**\n *\n * @param db A db handle.\n * @param options Optional settings.\n */\n constructor(db: Db, options?: GridFSBucketOptions)\n\n /**\n * Deletes a file with the given id.\n * @param id The id of the file doc\n * @param callback The result callback\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucket.html#delete\n */\n delete(id: ObjectID, callback?: GridFSBucketErrorCallback): void\n\n /**\n * Removes this bucket's files collection, followed by its chunks collection.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucket.html#drop\n */\n drop(callback?: GridFSBucketErrorCallback): void\n\n /**\n * Convenience wrapper around find on the files collection\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucket.html#find\n */\n find(filter?: Object, options?: GridFSBucketFindOptions): Cursor<any>\n\n /**\n * Returns a readable stream (GridFSBucketReadStream) for streaming file.\n * @param id The id of the file doc.\n * @param options Optional settings\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucket.html#openDownloadStream\n */\n openDownloadStream(\n id: ObjectID,\n options?: { start: number; end: number },\n ): GridFSBucketReadStream\n\n /**\n * Returns a readable stream (GridFSBucketReadStream) for streaming file\n * @param filename The id of the file doc\n * @param options Optional settings\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucket.html#openDownloadStreamByName\n */\n\n openDownloadStreamByName(\n filename: string,\n options?: { revision: number; start: number; end: number },\n ): GridFSBucketReadStream\n\n /**\n * Returns a writable stream (GridFSBucketWriteStream) for writing buffers to GridFS.\n * The stream's 'id' property contains the resulting file's id.\n * @param filename The value of the 'filename' key in the files doc.\n * @param options Optional settings\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucket.html#openUploadStream\n */\n openUploadStream(\n filename: string,\n options?: GridFSBucketOpenUploadStreamOptions,\n ): GridFSBucketWriteStream\n\n /**\n * Returns a writable stream (GridFSBucketWriteStream) for writing buffers to GridFS for a custom file id.\n * The stream's 'id' property contains the resulting file's id.\n * @param id A custom id used to identify the file.\n * @param filename The value of the 'filename' key in the files doc.\n * @param options Optional settings\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucket.html#openUploadStreamWithId\n */\n openUploadStreamWithId(\n id: string | number | Object,\n filename: string,\n options?: GridFSBucketOpenUploadStreamOptions,\n ): GridFSBucketWriteStream\n\n /**\n * Renames the file with the given _id to the given string.\n * @param id the id of the file to rename.\n * @param filename new name for the file.\n * @param callback The result callback\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucket.html#rename\n */\n rename(\n id: ObjectID,\n filename: string,\n callback?: GridFSBucketErrorCallback,\n ): void\n}\n\n/**\n * Constructor for a streaming GridFS interface.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucket.html\n */\nexport interface GridFSBucketOptions {\n /**\n * The 'files' and 'chunks' collections will be prefixed with the bucket name followed by a dot.\n */\n bucketName?: string\n\n /**\n * Number of bytes stored in each chunk. Defaults to 255KB.\n */\n chunkSizeBytes?: number\n\n /**\n * Optional write concern to be passed to write operations, for instance { w: 1 }.\n */\n writeConcern?: WriteConcern\n\n /**\n * Optional read preference to be passed to read operations.\n */\n ReadPreference?: ReadPreference\n}\n\n/**\n * GridFSBucketErrorCallback.\n * @param err An error instance representing any errors that occurred.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucket.html#~errorCallback\n */\nexport interface GridFSBucketErrorCallback {\n (err?: MongoError): void\n}\n\n/**\n * GridFSBucketFindOptions.\n * @see http://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucket.html#find\n */\nexport interface GridFSBucketFindOptions {\n /**\n * Optional batch size for cursor.\n */\n batchSize?: number\n\n /**\n * Optional limit for cursor.\n */\n limit?: number\n\n /**\n * Optional maxTimeMS for cursor.\n */\n maxTimeMS?: number\n\n /**\n * Optionally set cursor's noCursorTimeout flag.\n */\n noCursorTimeout?: boolean\n\n /**\n * Optional skip for cursor.\n */\n skip?: number\n\n /**\n * Optional sort for cursor.\n */\n sort?: Object\n}\n\n/**\n * GridFSBucketOpenUploadStreamOptions.\n * @see https://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucket.html#openUploadStream\n */\nexport interface GridFSBucketOpenUploadStreamOptions {\n /**\n * Optional overwrite this bucket's chunkSizeBytes for this file.\n */\n chunkSizeBytes?: number\n\n /**\n * Optional object to store in the file document's metadata field.\n */\n metadata?: Object\n\n /**\n * Optional string to store in the file document's contentType field.\n */\n contentType?: string\n\n /**\n * Optional array of strings to store in the file document's aliases field.\n */\n aliases?: Array<string>\n}\n\n/**\n * GridFSBucketReadStream.\n * @see https://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucketReadStream.html\n */\nexport declare class GridFSBucketReadStream extends Readable {\n /**\n *\n * @param chunks Handle for chunks collection.\n * @param files Handle for files collection.\n * @param readPreference The read preference to use.\n * @param filter The query to use to find the file document.\n * @param options Optional settings.\n */\n constructor(\n chunks: Collection<any>,\n files: Collection<any>,\n readPreference: Object,\n filter: Object,\n options?: GridFSBucketReadStreamOptions,\n )\n}\n\n/**\n * GridFSBucketReadStreamOptions.\n * @see https://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucketReadStream.html\n */\nexport interface GridFSBucketReadStreamOptions {\n /**\n * Optional sort for the file find query.\n */\n sort?: number\n\n /**\n * Optional skip for the file find query.\n */\n skip?: number\n\n /**\n * Optional 0-based offset in bytes to start streaming from.\n */\n start?: number\n\n /**\n * Optional 0-based offset in bytes to stop streaming before.\n */\n end?: number\n}\n\n/**\n * GridFSBucketWriteStream\n * @see https://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucketWriteStream.html\n */\nexport declare class GridFSBucketWriteStream extends Writable {\n /**\n *\n * @param bucket Handle for this stream's corresponding bucket.\n * @param filename The value of the 'filename' key in the files doc.\n * @param options Optional settings.\n */\n constructor(\n bucket: GridFSBucket,\n filename: string,\n options?: GridFSBucketWriteStreamOptions,\n )\n}\n\n/**\n * GridFSBucketWriteStreamOptions.\n * @see https://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucketWriteStream.html\n */\nexport interface GridFSBucketWriteStreamOptions {\n /**\n * Custom file id for the GridFS file.\n */\n id?: string | number | Object\n\n /**\n * The chunk size to use, in bytes.\n */\n chunkSizeBytes?: number\n\n /**\n * The write concern.\n */\n w?: number\n\n /**\n * The write concern timeout.\n */\n wtimeout?: number\n\n /**\n * The journal write concern.\n */\n j?: number\n}\n"],"sourceRoot":"../.."}