333
schangxiang@126.com
2025-09-19 18966e02fb573c7e2bb0c6426ed792b38b910940
1
{"version":3,"sources":["../../src/driver/mongodb/MongoConnectionOptions.ts"],"names":[],"mappings":"","file":"MongoConnectionOptions.js","sourcesContent":["import {BaseConnectionOptions} from \"../../connection/BaseConnectionOptions\";\nimport {ReadPreference} from \"./typings\";\n\n/**\n * MongoDB specific connection options.\n * Synced with http://mongodb.github.io/node-mongodb-native/3.1/api/MongoClient.html\n */\nexport interface MongoConnectionOptions extends BaseConnectionOptions {\n\n    /**\n     * Database type.\n     */\n    readonly type: \"mongodb\";\n\n    /**\n     * Connection url where perform connection to.\n     */\n    readonly url?: string;\n\n    /**\n     * Database host.\n     */\n    readonly host?: string;\n\n    /**\n     * Database host port.\n     */\n    readonly port?: number;\n\n    /**\n     * Database username.\n     */\n    readonly username?: string;\n\n    /**\n     * Database password.\n     */\n    readonly password?: string;\n\n    /**\n     * Database name to connect to.\n     */\n    readonly database?: string;\n\n    /**\n     * Set the maximum poolSize for each individual server or proxy connection.\n     */\n    readonly poolSize?: number;\n\n    /**\n     * Use ssl connection (needs to have a mongod server with ssl support). Default: false\n     */\n    readonly 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     * Default: true\n     */\n    readonly sslValidate?: boolean;\n\n    /**\n     * Array of valid certificates either as Buffers or Strings\n     * (needs to have a mongod server with ssl support, 2.4 or higher).\n     */\n    readonly sslCA?: string[]|Buffer[];\n\n    /**\n     * String or buffer containing the certificate we wish to present\n     * (needs to have a mongod server with ssl support, 2.4 or higher)\n     */\n    readonly sslCert?: string|Buffer;\n\n    /**\n     * String or buffer containing the certificate private key we wish to present\n     * (needs to have a mongod server with ssl support, 2.4 or higher)\n     */\n    readonly sslKey?: string;\n\n    /**\n     * String or buffer containing the certificate password\n     * (needs to have a mongod server with ssl support, 2.4 or higher)\n     */\n    readonly sslPass?: string|Buffer;\n\n    /**\n     * SSL Certificate revocation list binary buffer\n     * (needs to have a mongod server with ssl support, 2.4 or higher)\n     */\n    readonly sslCRL?: string|Buffer;\n\n    /**\n     * Reconnect on error. Default: true\n     */\n    readonly autoReconnect?: boolean;\n\n    /**\n     * TCP Socket NoDelay option. Default: true\n     */\n    readonly noDelay?: boolean;\n\n    /**\n     * The number of milliseconds to wait before initiating keepAlive on the TCP socket. Default: 30000\n     */\n    readonly keepAlive?: number;\n\n    /**\n     * TCP Connection timeout setting. Default: 30000\n     */\n    readonly connectTimeoutMS?: number;\n\n    /**\n     * Version of IP stack. Can be 4, 6.\n     * If undefined, will attempt to connect with IPv6, and will fall back to IPv4 on failure\n     */\n    readonly family?: number;\n\n    /**\n     * TCP Socket timeout setting. Default: 360000\n     */\n    readonly socketTimeoutMS?: number;\n\n    /**\n     * Server attempt to reconnect #times. Default 30\n     */\n    readonly reconnectTries?: number;\n\n    /**\n     * Server will wait #milliseconds between retries. Default 1000\n     */\n    readonly reconnectInterval?: number;\n\n    /**\n     * Control if high availability monitoring runs for Replicaset or Mongos proxies. Default true\n     */\n    readonly ha?: boolean;\n\n    /**\n     * The High availability period for replicaset inquiry. Default: 10000\n     */\n    readonly haInterval?: number;\n\n    /**\n     * The name of the replicaset to connect to\n     */\n    readonly 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     * Default: 15\n     */\n    readonly acceptableLatencyMS?: number;\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     * Default: 15\n     */\n    readonly secondaryAcceptableLatencyMS?: number;\n\n    /**\n     * Sets if the driver should connect even if no primary is available. Default: false\n     */\n    readonly connectWithNoPrimary?: boolean;\n\n    /**\n     * If the database authentication is dependent on another databaseName.\n     */\n    readonly authSource?: string;\n\n    /**\n     * The write concern.\n     */\n    readonly w?: string|number;\n\n    /**\n     * The write concern timeout value.\n     */\n    readonly wtimeout?: number;\n\n    /**\n     * Specify a journal write concern. Default: false\n     */\n    readonly j?: boolean;\n\n    /**\n     * Force server to assign _id values instead of driver. Default: false\n     */\n    readonly forceServerObjectId?: boolean;\n\n    /**\n     * Serialize functions on any object. Default: false\n     */\n    readonly serializeFunctions?: boolean;\n\n    /**\n     * Specify if the BSON serializer should ignore undefined fields. Default: false\n     */\n    readonly ignoreUndefined?: boolean;\n\n    /**\n     * Return document results as raw BSON buffers. Default: false\n     */\n    readonly raw?: boolean;\n\n    /**\n     * Promotes Long values to number if they fit inside the 53 bits resolution. Default: true\n     */\n    readonly promoteLongs?: boolean;\n\n    /**\n     * Promotes Binary BSON values to native Node Buffers. Default: false\n     */\n    readonly promoteBuffers?: boolean;\n\n    /**\n     * Promotes BSON values to native types where possible, set to false to only receive wrapper types. Default: true\n     */\n    readonly promoteValues?: boolean;\n\n    /**\n     * Enable the wrapping of the callback in the current domain, disabled by default to avoid perf hit. Default: false\n     */\n    readonly domainsEnabled?: boolean;\n\n    /**\n     * Sets a cap on how many operations the driver will buffer up before giving up on getting a working connection,\n     * default is -1 which is unlimited.\n     */\n    readonly bufferMaxEntries?: number;\n\n    /**\n     * The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY,\n     * ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).\n     */\n    readonly readPreference?: ReadPreference|string;\n\n    /**\n     * A primary key factory object for generation of custom _id keys.\n     */\n    readonly pkFactory?: any;\n\n    /**\n     * A Promise library class the application wishes to use such as Bluebird, must be ES6 compatible.\n     */\n    readonly promiseLibrary?: any;\n\n    /**\n     * Specify a read concern for the collection. (only MongoDB 3.2 or higher supported).\n     */\n    readonly readConcern?: any;\n\n    /**\n     * Specify a maxStalenessSeconds value for secondary reads, minimum is 90 seconds\n     */\n    readonly maxStalenessSeconds?: number;\n\n    /**\n     * Specify the log level used by the driver logger (error/warn/info/debug).\n     */\n    readonly loggerLevel?: \"error\"|\"warn\"|\"info\"|\"debug\";\n\n    // Do not overwrite BaseConnectionOptions.logger\n    // readonly logger?: any;\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     * Default: true\n     */\n    readonly checkServerIdentity?: boolean|Function;\n\n    /**\n     * Validate MongoClient passed in options for correctness. Default: false\n     */\n    readonly validateOptions?: boolean|any;\n\n    /**\n     * The name of the application that created this MongoClient instance. MongoDB 3.4 and newer will print this value in the server log upon establishing each connection. It is also recorded in the slow query log and profile collections\n     */\n    readonly appname?: string;\n\n    /**\n     * Sets the authentication mechanism that MongoDB will use to authenticate the connection\n     */\n    readonly authMechanism?: string;\n\n    /**\n     * Type of compression to use: snappy or zlib\n     */\n    readonly compression?: any;\n\n    /**\n     * Specify a file sync write concern. Default: false\n     */\n    readonly fsync?: boolean;\n\n    /**\n     * Read preference tags\n     */\n    readonly readPreferenceTags?: any[];\n\n    /**\n     * The number of retries for a tailable cursor. Default: 5\n     */\n    readonly numberOfRetries?: number;\n\n    /**\n     * Enable auto reconnecting for single server instances. Default: true\n     */\n    readonly auto_reconnect?: boolean;\n\n    /**\n     * Enable command monitoring for this client. Default: false\n     */\n    readonly monitorCommands?: boolean;\n\n    /**\n     * If present, the connection pool will be initialized with minSize connections, and will never dip below minSize connections\n     */\n    readonly minSize?: number;\n\n    /**\n     * Determines whether or not to use the new url parser. Default: false\n     */\n    readonly useNewUrlParser?: boolean;\n}\n"],"sourceRoot":"../.."}