Options
All
  • Public
  • Public/Protected
  • All
Menu

MongoDB specific connection options.

Hierarchy

Index

Properties

Optional acceptableLatencyMS

acceptableLatencyMS: undefined | number

Sets the range of servers to pick when using NEAREST (lowest ping ms + the latency fence, ex: range of 1 to (1 + 15) ms). Default: 15

Optional authMechanism

authMechanism: undefined | string

Sets the authentication mechanism that MongoDB will use to authenticate the connection

Optional authSource

authSource: undefined | string

If the database authentication is dependent on another databaseName.

Optional autoReconnect

autoReconnect: undefined | true | false

Reconnect on error. Default: true

Optional bufferMaxEntries

bufferMaxEntries: undefined | true | false

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.

Optional cache

cache: boolean | object

Allows to setup cache options.

Optional cli

cli: undefined | object

CLI settings.

Optional connectTimeoutMS

connectTimeoutMS: undefined | number

TCP Connection timeout setting. Default: 30000

Optional connectWithNoPrimary

connectWithNoPrimary: undefined | true | false

Sets if the driver should connect even if no primary is available. Default: false

Optional database

database: undefined | string

Database name to connect to.

Optional domainsEnabled

domainsEnabled: undefined | true | false

Enable the wrapping of the callback in the current domain, disabled by default to avoid perf hit. Default: false

Optional dropSchema

dropSchema: undefined | true | false

Drops the schema each time connection is being established. Be careful with this option and don't use this in production - otherwise you'll lose all production data. This option is useful during debug and development.

Optional entities

entities: (string | Function | EntitySchema<any>)[]

Entities to be loaded for this connection. Accepts both entity classes and directories where from entities need to be loaded. Directories support glob patterns.

Optional entityPrefix

entityPrefix: undefined | string

Prefix to use on all tables (collections) of this connection in the database.

Optional extra

extra: any

Extra connection options to be passed to the underlying driver.

todo: deprecate this and move all database-specific types into hts own connection options object.

Optional forceServerObjectId

forceServerObjectId: undefined | true | false

Force server to assign _id values instead of driver. Default: false

Optional ha

ha: undefined | true | false

Turn on high availability monitoring. Default true

Optional haInterval

haInterval: undefined | number

Time between each replicaset status check. Default: 10000,5000

Optional host

host: undefined | string

Database host.

Optional ignoreUndefined

ignoreUndefined: undefined | true | false

Specify if the BSON serializer should ignore undefined fields. Default: false

Optional j

j: undefined | true | false

Specify a journal write concern. Default: false

Optional keepAlive

keepAlive: undefined | number

The number of milliseconds to wait before initiating keepAlive on the TCP socket. Default: 30000

Optional logger

logger: "advanced-console" | "simple-console" | "file" | "debug" | Logger

Logger instance used to log queries and events in the ORM.

Optional loggerLevel

loggerLevel: "error" | "warn" | "info" | "debug"

Specify the log level used by the driver logger (error/warn/info/debug).

Optional logging

logging: LoggerOptions

Logging options.

Optional maxQueryExecutionTime

maxQueryExecutionTime: undefined | number

Maximum number of milliseconds query should be executed before logger log a warning.

Optional maxStalenessSeconds

maxStalenessSeconds: undefined | number

Specify a maxStalenessSeconds value for secondary reads, minimum is 90 seconds

Optional migrations

migrations: (string | Function)[]

Migrations to be loaded for this connection. Accepts both migration classes and directories where from migrations need to be loaded. Directories support glob patterns.

Optional migrationsRun

migrationsRun: undefined | true | false

Indicates if migrations should be auto run on every application launch. Alternative to it, you can use CLI and run migrations:run command.

Optional migrationsTableName

migrationsTableName: undefined | string

Migrations table name, in case of different name from "migrations". Accepts single string name.

Optional name

name: undefined | string

Connection name. If connection name is not given then it will be called "default". Different connections must have different names.

Optional namingStrategy

namingStrategy: NamingStrategyInterface

Naming strategy to be used to name tables and columns in the database.

Optional noDelay

noDelay: undefined | true | false

TCP Socket NoDelay option. Default: true

Optional password

password: undefined | string

Database password.

Optional pkFactory

pkFactory: any

A primary key factory object for generation of custom _id keys.

Optional poolSize

poolSize: undefined | number

Set the maximum poolSize for each individual server or proxy connection.

Optional port

port: undefined | number

Database host port.

Optional promiseLibrary

promiseLibrary: any

A Promise library class the application wishes to use such as Bluebird, must be ES6 compatible.

Optional promoteBuffers

promoteBuffers: undefined | true | false

Promotes Binary BSON values to native Node Buffers. Default: false

Optional promoteLongs

promoteLongs: undefined | true | false

Promotes Long values to number if they fit inside the 53 bits resolution. Default: true

Optional promoteValues

promoteValues: undefined | true | false

Promotes BSON values to native types where possible, set to false to only receive wrapper types. Default: true

Optional raw

raw: undefined | true | false

Return document results as raw BSON buffers. Default: false

Optional readConcern

readConcern: any

Specify a read concern for the collection. (only MongoDB 3.2 or higher supported).

Optional readPreference

readPreference: ReadPreference

The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).

Optional reconnectInterval

reconnectInterval: undefined | number

Server will wait #milliseconds between retries. Default 1000

Optional reconnectTries

reconnectTries: undefined | number

Server attempt to reconnect #times. Default 30

Optional replicaSet

replicaSet: undefined | string

The name of the replicaset to connect to

Optional secondaryAcceptableLatencyMS

secondaryAcceptableLatencyMS: undefined | number

Sets the range of servers to pick when using NEAREST (lowest ping ms + the latency fence, ex: range of 1 to (1 + 15) ms). Default: 15

Optional serializeFunctions

serializeFunctions: undefined | true | false

Serialize functions on any object. Default: false

Optional socketTimeoutMS

socketTimeoutMS: undefined | number

TCP Socket timeout setting. Default: 360000

Optional ssl

ssl: undefined | true | false

Use ssl connection (needs to have a mongod server with ssl support). Default: false

Optional sslCA

sslCA: string[] | Buffer[]

Array of valid certificates either as Buffers or Strings (needs to have a mongod server with ssl support, 2.4 or higher).

Optional sslCert

sslCert: string | Buffer

String or buffer containing the certificate we wish to present (needs to have a mongod server with ssl support, 2.4 or higher)

Optional sslKey

sslKey: string | Buffer

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)

Optional sslPass

sslPass: string | Buffer

String or buffer containing the certificate password (needs to have a mongod server with ssl support, 2.4 or higher)

Optional sslValidate

sslValidate: undefined | true | false

Validate mongod server certificate against ca (needs to have a mongod server with ssl support, 2.4 or higher). Default: true

Optional subscribers

subscribers: (string | Function)[]

Subscribers to be loaded for this connection. Accepts both subscriber classes and directories where from subscribers need to be loaded. Directories support glob patterns.

Optional synchronize

synchronize: undefined | true | false

Indicates if database schema should be auto created on every application launch. Be careful with this option and don't use this in production - otherwise you can lose production data. This option is useful during debug and development. Alternative to it, you can use CLI and run schema:sync command.

Note that for MongoDB database it does not create schema, because MongoDB is schemaless. Instead, it syncs just by creating indices.

type

type: "mongodb"

Database type.

Optional url

url: undefined | string

Connection url where perform connection to.

Optional username

username: undefined | string

Database username.

Optional w

w: string | number

The write concern.

Optional wtimeout

wtimeout: undefined | number

The write concern timeout value.

Generated using TypeDoc