* added find options and new option relationLoadStrategy * find now returns null instead of undefined; removed primary relations support; bugfixing; added some changes and tests from next branch; * added typename to connection options; added data loader types, lot of deprecations; new es2020 emit by tsc; new custom repositories syntax * applied lint fixing * replaced some instanceof checks * reverting docker compose image versions * optimizing imports * reverting back some instanceof checks to prevent compiler errors * downgrading es compilation version * docs: remove "primary" from relation options (#8619) remove ex-line 26 for being deprecated in 0.3.0: "* `primary: boolean` - Indicates whether this relation's column will be a primary column or not." * Revert "reverting back some instanceof checks to prevent compiler errors" This reverts commit 7bf12a39e2297d097aa2a42989afd0e9e4f49bb0. * Revert "optimizing imports" This reverts commit 7588ac14e4f1bf1a82e3b7883134b9c2c8ae5f3f. * Revert "replaced some instanceof checks" This reverts commit bfa5a2d706f697ed1c1beb38b4455c0d33121e5a. * fixing few comments * removing transaction decorators * this test is invalid - it's not clear why the hell getTreeRepository will throw an error and it's not clear what kind of error its going to throw * addded mixed list support in connection options * trying to fix oracle length issue * lintfix * removed shorten usages * added named entity target support to the connection * fixing entity target support in relation options via entity schema * debugging oracle issue * fixed issue with alias not being shortened in many to many alias cases * some day we'll have a prettier. * fixing oracle tests * fixing oracle failing test * removed "null" support in where expressions; fixed softDelete and restore incorrect usages * renamed FindConditions to FindOptionsWhere * version bump * docs: update loading relation in find method (v 0.3.0) (#8621) * docs: update relation definition method Update the method that allows loading a specific relation inside the find method. This method is found on the one-to-one-relations page. Change `const users = await userRepository.find({ relations: ["profile"] });` to `const users = await userRepository.find({ relations: {profile: true});`. * fix formatting Co-authored-by: Umed Khudoiberdiev <pleerock.me@gmail.com> * docs: change relations option definition (#8620) * docs: change relations option definition change line 139 from `const users = await connection.getRepository(User).find({ relations: ["profile", "photos", "videos"] });` to `const users = await connection.getRepository(User).find({ relations: { profile: true, photos: true, videos: true] });` to reflect version 0.3.0 changes * docs: change relations option definition Rectified a type on line 139 from: `const users = await connection.getRepository(User).find({ relations: { profile: true, photos: true, videos: true] });` to `const users = await connection.getRepository(User).find({ relations: { profile: true, photos: true, videos: true} });` * formatting Co-authored-by: Umed Khudoiberdiev <pleerock.me@gmail.com> * lint * improved find options types * fixed types and removed nonnever because it causes circual issue for some reason * docs: update entitymanager definition (#8623) * docs: update entitymanager definition change the "What is EntityManager?" page to be up-to-date with v 0.3.0 1. line 6 changes from `You can access the entity manager via 'getManager()' or from 'Connection'.` to `You can access the entity manager via DataSource's manager.` 2. the import on `getManager` in line 10 becomes `Manager` that the user have configured beforehand: `import {getManager} from "typeorm";` becomes `import {Manager} from "./config/DataSource";` 3.change entityManager definition in line 13: from `const entityManager = getManager(); // you can also get it via getConnection().manager` to `const entityManager = Manager;` * docs: update entitymanager definition changed line 10 from: `import {Manager} from "./config/DataSource";` to `import {DataSource} from "typeorm";` and changed line 13 and 14 from: `const entityManager = Manager;` `const user = await entityManager.findOne(User, 1);` to `const myDataSource = new DataSource({ /*...*/ });` `const user = await myDataSource.manager.findOne(User, 1);` for a simpler way of describing the origin of DataSource and how it works. * In return type doesn't seem to work in all cases * feat: mssql v7 support (#8592) Adds support for v7 of the mssql library as v6 is EOL. This also makes use of the new toReadableStream method on requests to return a native stream where required. * fix: prefix relation id columns contained in embedded entities (#6977) (#7432) * fix: prefix relation id columns contained in embedded entities (#6977) Searches embedded entity columns for relation ID column if relation column is in embedded entity. If not found, creates new relation ID with embedded metadata set to match the relation column. fixes: #2254 fixes: #3132 fixes: #3226 fixes: #6977 * test: prefix subcounters sub-entity with "sub" to fit in 30 character identifier for oracle Problem introduced with #6981 * fix: find by Date object in sqlite driver (#7538) * fix: find by Date object in sqlite driver In sqlite, Date objects are persisted as UtcDatetimeString. But a Date object parameter was escaped with .toISOString(), making such queries impossible. This commit aligns both transforms. This bug does *not* apply to better-sql where you can only bind numbers, strings, bigints, buffers, and null. This is breaking for when the user inserted their dates manually as ISO and relied on this old maltransformation, after this their find()s by Date won't work anymore. BREAKING CHANGE: Change Date serialization in selects Closes: #2286 * add failing test * fix: find by Date object in sqlite driver (with query builder) Also consider query builder parameter escaping * test: add test for 3426 Co-authored-by: James Ward <james@notjam.es> * manually ported changes from #7796 * updated changelog * fixes after merge * new findOne syntax * new find* syntax * new find* syntax * lint * tsc version bump * tsc version bump and fixed mongodb issues * moved date fns into non dev deps * returned oracledb dep into place * removed lock files * returned lock files back * eslint upgrade * fixing mongodb issue * fixing mongodb issue * test: keep junction aliases short (#8637) Tests a fix for an issue where junction aliases (e.g. in many-to-many relations) are not unique because they are too long and thus truncated by the driver. Closes: #8627 Related to: 76cee41dcf1c146d02715c7f48fed33672d28c67 * fixing mongodb issues * fixing sqlite test * fixing sqlite test * fixing sqlite test * fixing mongodb test * fixing entity schema tests * fixing entity schema tests * merged latest master * removed driver instanceof checks * removed function instanceof checks * removed Object instanceof checks * removing instanceof checks... * fixing instanceof checks * added InstanceChecker to remove remaining instanceof checks * fixed failing test * linting * fixing failing test * version bump * compiler fixes * Connection type usages replace to DataSource * updated dev deps * updated deps, add prettier, removed oracledb due to m1 issue * chalk downgrade * fixing failing test * applied prettier formatting * replaced eslint to prettier * okay I think we can call it lint * fixing linting * fixed prettier introduced compiler bug * fixed failing test * prettier; * fixed failing test * alias shortening only for junction tables; fixed failing tests; * changed aurora db names and reverted change of junction table name shorten algorithm * format * removed platform from docker compose * made numeric parameters to not use parameters to prevent parameters number limit issue. Also enabled shorten only for junction tables * fixing test * fixing returning columns bugs * fixing test * fixed returning issue * fixing merge conflicts * updating documentation * working on docs / improving api * working on docs * fixed isConnected issue * re-worked commands * commenting cli command tests for now * commenting cli command tests for now * removed platform * returned Connection back * refactor: export tree repository helper methods (#8753) * Migrated protected tree methods to util class * Added tree repository extend override * Ran prettier format * merge master into 0.3.0 Co-authored-by: Bitcollage <serkan.sipahi@yahoo.de> * working on documentation Co-authored-by: Bilel Taktak <47742269+Parsath@users.noreply.github.com> Co-authored-by: Salah Azzouz <52634440+Salah-Azzouz@users.noreply.github.com> Co-authored-by: Daniel Hensby <dhensby@users.noreply.github.com> Co-authored-by: Nebojša Cvetković <nebkat@gmail.com> Co-authored-by: Philip Waritschlager <philip+github@waritschlager.de> Co-authored-by: James Ward <james@notjam.es> Co-authored-by: Felix Gohla <37421906+felix-gohla@users.noreply.github.com> Co-authored-by: Dmitry Zotov <dmzt08@gmail.com> Co-authored-by: Jimmy Chen <50786287+Q16solver@users.noreply.github.com> Co-authored-by: Bitcollage <serkan.sipahi@yahoo.de>
27 KiB
Data Source Options
- What is
DataSourceOptions - Common data source options
mysql/mariadbdata source optionspostgres/cockroachdbdata source optionssqlitedata source optionsbetter-sqlite3data source optionscapacitordata source optionscordovadata source optionsreact-nativedata source optionsnativescriptdata source optionsmssqldata source optionsmongodbdata source optionssql.jsdata source optionsexpodata source options- Connection options example
What is DataSourceOptions
DataSourceOptions is a data source configuration you pass when you create a new DataSource instance.
Different RDBMS-es have their own specific options.
Common data source options
-
type- RDBMS type. You must specify what database engine you use. Possible values are: "mysql", "postgres", "cockroachdb", "sap", "mariadb", "sqlite", "cordova", "react-native", "nativescript", "sqljs", "oracle", "mssql", "mongodb", "aurora-mysql", "aurora-postgres", "expo", "better-sqlite3", "capacitor". This option is required. -
extra- Extra options to be passed to the underlying driver. Use it if you want to pass extra settings to underlying database driver. -
entities- Entities, or Entity Schemas, to be loaded and used for this data source. Accepts both entity classes, entity schema classes, and directories paths to load from. Directories support glob patterns. Example:entities: [Post, Category, "entity/*.js", "modules/**/entity/*.js"]. Learn more about Entities. Learn more about Entity Schemas. -
subscribers- Subscribers to be loaded and used for this data source. Accepts both entity classes and directories to load from. Directories support glob patterns. Example:subscribers: [PostSubscriber, AppSubscriber, "subscriber/*.js", "modules/**/subscriber/*.js"]. Learn more about Subscribers. -
migrations- Migrations to be loaded and used for this data source. Accepts both migration classes and directories to load from. Directories support glob patterns. Example:migrations: [FirstMigration, SecondMigration, "migration/*.js", "modules/**/migration/*.js"]. Learn more about Migrations. -
logging- Indicates if logging is enabled or not. If set totruethen query and error logging will be enabled. You can also specify different types of logging to be enabled, for example["query", "error", "schema"]. Learn more about Logging. -
logger- Logger to be used for logging purposes. Possible values are "advanced-console", "simple-console" and "file". Default is "advanced-console". You can also specify a logger class that implementsLoggerinterface. Learn more about Logging. -
maxQueryExecutionTime- If query execution time exceed this given max execution time (in milliseconds) then logger will log this query. -
namingStrategy- Naming strategy to be used to name tables and columns in the database. -
entityPrefix- Prefixes with the given string all tables (or collections) on this data source. -
entitySkipConstructor- Indicates if TypeORM should skip constructors when deserializing entities from the database. Note that when you do not call the constructor both private properties and default properties will not operate as expected. -
dropSchema- Drops the schema each time data source is being initialized. 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. -
synchronize- 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. As an 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. -
migrationsRun- Indicates if migrations should be auto run on every application launch. As an alternative, you can use CLI and run migration:run command. -
migrationsTableName- Name of the table in the database which is going to contain information about executed migrations. By default, this table is called "migrations". -
migrationsTransactionMode- Control transactions for migrations (default:all), can be one ofall|none|each -
metadataTableName- Name of the table in the database which is going to contain information about table metadata. By default, this table is called "typeorm_metadata". -
cache- Enables entity result caching. You can also configure cache type and other cache options here. Read more about caching here. -
cli.entitiesDir- Directory where entities should be created by default by CLI. -
cli.migrationsDir- Directory where migrations should be created by default by CLI. -
cli.subscribersDir- Directory where subscribers should be created by default by CLI.
mysql / mariadb data source options
-
url- Connection url where perform connection to. Please note that other data source options will override parameters set from url. -
host- Database host. -
port- Database host port. Default mysql port is3306. -
username- Database username. -
password- Database password. -
database- Database name. -
charset- The charset for the connection. This is called "collation" in the SQL-level of MySQL (like utf8_general_ci). If a SQL-level charset is specified (like utf8mb4) then the default collation for that charset is used. (Default:UTF8_GENERAL_CI). -
timezone- the timezone configured on the MySQL server. This is used to typecast server date/time values to JavaScript Date object and vice versa. This can belocal,Z, or an offset in the form+HH:MMor-HH:MM. (Default:local) -
connectTimeout- The milliseconds before a timeout occurs during the initial connection to the MySQL server. (Default:10000) -
acquireTimeout- The milliseconds before a timeout occurs during the initial connection to the MySql server. It differs fromconnectTimeoutas it governs the TCP connection timeout where as connectTimeout does not. (default:10000) -
insecureAuth- Allow connecting to MySQL instances that ask for the old (insecure) authentication method. (Default:false) -
supportBigNumbers- When dealing with big numbers (BIGINTandDECIMALcolumns) in the database, you should enable this option (Default:true) -
bigNumberStrings- Enabling bothsupportBigNumbersandbigNumberStringsforces big numbers (BIGINTandDECIMALcolumns) to be always returned as JavaScript String objects (Default:true). EnablingsupportBigNumbersbut leavingbigNumberStringsdisabled will return big numbers as String objects only when they cannot be accurately represented with JavaScript Number objects (which happens when they exceed the[-2^53, +2^53]range), otherwise they will be returned as Number objects. This option is ignored ifsupportBigNumbersis disabled. -
dateStrings- Force date types (TIMESTAMP,DATETIME,DATE) to be returned as strings rather than inflated into JavaScript Date objects. Can be true/false or an array of type names to keep as strings. (Default:false) -
debug- Prints protocol details to stdout. Can be true/false or an array of packet type names that should be printed. (Default:false) -
trace- Generates stack traces on Error to include call site of library entrance ("long stack traces"). Slight performance penalty for most calls. (Default:true) -
multipleStatements- Allow multiple mysql statements per query. Be careful with this, it could increase the scope of SQL injection attacks. (Default:false) -
legacySpatialSupport- Use spatial functions like GeomFromText and AsText which are removed in MySQL 8. (Default: true) -
flags- List of connection flags to use other than the default ones. It is also possible to blacklist default ones. For more information, check Connection Flags. -
ssl- object with ssl parameters or a string containing the name of ssl profile. See SSL options.
postgres / cockroachdb data source options
-
url- Connection url where perform connection to. Please note that other data source options will override parameters set from url. -
host- Database host. -
port- Database host port. Default postgres port is5432. -
username- Database username. -
password- Database password. -
database- Database name. -
schema- Schema name. Default is "public". -
connectTimeoutMS- The milliseconds before a timeout occurs during the initial connection to the postgres server. Ifundefined, or set to0, there is no timeout. Defaults toundefined. -
ssl- Object with ssl parameters. See TLS/SSL. -
uuidExtension- The Postgres extension to use when generating UUIDs. Defaults touuid-ossp. Can be changed topgcryptoif theuuid-osspextension is unavailable. -
poolErrorHandler- A function that get's called when underlying pool emits'error'event. Takes single parameter (error instance) and defaults to logging withwarnlevel. -
logNotifications- A boolean to determine whether postgres server notice messages and notification events should be included in client's logs withinfolevel (default:false). -
installExtensions- A boolean to control whether to install necessary postgres extensions automatically or not (default:true) -
applicationName- A string visible in statistics and logs to help referencing an application to a connection (default:undefined)
sqlite data source options
database- Database path. For example "mydb.sql"
better-sqlite3 data source options
-
database- Database path. For example "mydb.sql" -
statementCacheSize- Cache size of sqlite statement to speed up queries (default 100). -
prepareDatabase- Function to run before a database is used in typeorm. You can access original better-sqlite3 Database object here.
capacitor data source options
-
database- Database name (capacitor-sqlite will add the suffixSQLite.db) -
driver- The capacitor-sqlite instance. For example,new SQLiteConnection(CapacitorSQLite). -
mode- Set the mode for database encryption: "no-encryption" | "encryption" | "secret" | "newsecret" -
version- Database version -
journalMode- The SQLite journal mode (optional)
cordova data source options
-
database- Database name -
location- Where to save the database. See cordova-sqlite-storage for options.
react-native data source options
-
database- Database name -
location- Where to save the database. See react-native-sqlite-storage for options.
nativescript data source options
database- Database name
mssql data source options
-
url- Connection url where perform connection to. Please note that other data source options will override parameters set from url. -
host- Database host. -
port- Database host port. Default mssql port is1433. -
username- Database username. -
password- Database password. -
database- Database name. -
schema- Schema name. Default is "public". -
domain- Once you set domain, the driver will connect to SQL Server using domain login. -
connectionTimeout- Connection timeout in ms (default:15000). -
requestTimeout- Request timeout in ms (default:15000). NOTE: msnodesqlv8 driver doesn't support timeouts < 1 second. -
stream- Stream recordsets/rows instead of returning them all at once as an argument of callback (default:false). You can also enable streaming for each request independently (request.stream = true). Always set totrueif you plan to work with a large amount of rows. -
pool.max- The maximum number of connections there can be in the pool (default:10). -
pool.min- The minimum of connections there can be in the pool (default:0). -
pool.maxWaitingClients- maximum number of queued requests allowed, additional acquire calls will be callback with an err in a future cycle of the event loop. -
pool.testOnBorrow- should the pool validate resources before giving them to clients. Requires that eitherfactory.validateorfactory.validateAsyncto be specified. -
pool.acquireTimeoutMillis- max milliseconds anacquirecall will wait for a resource before timing out. (default no limit), if supplied should non-zero positive integer. -
pool.fifo- if true the oldest resources will be first to be allocated. If false the most recently released resources will be the first to be allocated. This in effect turns the pool's behaviour from a queue into a stack. boolean, (defaulttrue). -
pool.priorityRange- int between 1 and x - if set, borrowers can specify their relative priority in the queue if no resources are available. see example. (default1). -
pool.evictionRunIntervalMillis- How often to run eviction checks. Default:0(does not run). -
pool.numTestsPerRun- Number of resources to check each eviction run. Default:3. -
pool.softIdleTimeoutMillis- amount of time an object may sit idle in the pool before it is eligible for eviction by the idle object evictor (if any), with the extra condition that at least "min idle" object instances remain in the pool. Default-1(nothing can get evicted). -
pool.idleTimeoutMillis- the minimum amount of time that an object may sit idle in the pool before it is eligible for eviction due to idle time. SupersedessoftIdleTimeoutMillis. Default:30000. -
pool.errorHandler- A function that get's called when underlying pool emits'error'event. Takes single parameter (error instance) and defaults to logging withwarnlevel. -
options.fallbackToDefaultDb- By default, if the database requestion byoptions.databasecannot be accessed, the connection will fail with an error. However, ifoptions.fallbackToDefaultDbis set totrue, then the user's default database will be used instead (Default:false). -
options.instanceName- The instance name to connect to. The SQL Server Browser service must be running on the database server, and UDP port 1434 on the database server must be reachable. Mutually exclusive withport. (no default). -
options.enableAnsiNullDefault- If true, SET ANSI_NULL_DFLT_ON ON will be set in the initial sql. This means new columns will be nullable by default. See the T-SQL documentation for more details. (Default:true). -
options.cancelTimeout- The number of milliseconds before the cancel (abort) of a request is considered failed (default:5000). -
options.packetSize- The size of TDS packets (subject to negotiation with the server). Should be a power of 2. (default:4096). -
options.useUTC- A boolean determining whether to pass time values in UTC or local time. (default:true). -
options.abortTransactionOnError- A boolean determining whether to rollback a transaction automatically if any error is encountered during the given transaction's execution. This sets the value forSET XACT_ABORTduring the initial SQL phase of a connection (documentation). -
options.localAddress- A string indicating which network interface (ip address) to use when connecting to SQL Server. -
options.useColumnNames- A boolean determining whether to return rows as arrays or key-value collections. (default:false). -
options.camelCaseColumns- A boolean, controlling whether the column names returned will have the first letter converted to lower case (true) or not. This value is ignored if you provide acolumnNameReplacer. (default:false). -
options.isolationLevel- The default isolation level that transactions will be run with. The isolation levels are available fromrequire('tedious').ISOLATION_LEVEL.READ_UNCOMMITTEDREAD_COMMITTEDREPEATABLE_READSERIALIZABLESNAPSHOT
(default:
READ_COMMITTED) -
options.connectionIsolationLevel- The default isolation level for new connections. All out-of-transaction queries are executed with this setting. The isolation levels are available fromrequire('tedious').ISOLATION_LEVEL.READ_UNCOMMITTEDREAD_COMMITTEDREPEATABLE_READSERIALIZABLESNAPSHOT
(default:
READ_COMMITTED) -
options.readOnlyIntent- A boolean, determining whether the connection will request read-only access from a SQL Server Availability Group. For more information, see here. (default:false). -
options.encrypt- A boolean determining whether or not the connection will be encrypted. Set to true if you're on Windows Azure. (default:false). -
options.cryptoCredentialsDetails- When encryption is used, an object may be supplied that will be used for the first argument when calling tls.createSecurePair (default:{}). -
options.rowCollectionOnDone- A boolean, that when true will expose received rows in Requests'done*events. See done, doneInProc and doneProc. (default:false)Caution: If many rows are received, enabling this option could result in excessive memory usage.
-
options.rowCollectionOnRequestCompletion- A boolean, that when true will expose received rows in Requests' completion callback. See new Request. (default:false)Caution: If many rows are received, enabling this option could result in excessive memory usage.
-
options.tdsVersion- The version of TDS to use. If the server doesn't support the specified version, a negotiated version is used instead. The versions are available fromrequire('tedious').TDS_VERSION.7_17_27_3_A7_3_B7_4
(default:
7_4) -
options.debug.packet- A boolean, controlling whetherdebugevents will be emitted with text describing packet details (default:false). -
options.debug.data- A boolean, controlling whetherdebugevents will be emitted with text describing packet data details (default:false). -
options.debug.payload- A boolean, controlling whetherdebugevents will be emitted with text describing packet payload details (default:false). -
options.debug.token- A boolean, controlling whetherdebugevents will be emitted with text describing token stream tokens (default:false).
mongodb data source options
-
url- Connection url where perform connection to. Please note that other data source options will override parameters set from url. -
host- Database host. -
port- Database host port. Default mongodb port is27017. -
username- Database username (replacement forauth.user). -
password- Database password (replacement forauth.password). -
database- Database name. -
poolSize- Set the maximum pool size for each individual server or proxy connection. -
ssl- Use ssl connection (needs to have a mongod server with ssl support). Default:false. -
sslValidate- Validate mongod server certificate against ca (needs to have a mongod server with ssl support, 2.4 or higher). Default:true. -
sslCA- Array of valid certificates either as Buffers or Strings (needs to have a mongod server with ssl support, 2.4 or higher). -
sslCert- String or buffer containing the certificate we wish to present (needs to have a mongod server with ssl support, 2.4 or higher) -
sslKey- 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). -
sslPass- String or buffer containing the certificate password (needs to have a mongod server with ssl support, 2.4 or higher). -
autoReconnect- Reconnect on error. Default:true. -
noDelay- TCP Socket NoDelay option. Default:true. -
keepAlive- The number of milliseconds to wait before initiating keepAlive on the TCP socket. Default:30000. -
connectTimeoutMS- TCP Connection timeout setting. Default:30000. -
socketTimeoutMS- TCP Socket timeout setting. Default:360000. -
reconnectTries- Server attempt to reconnect #times. Default:30. -
reconnectInterval- Server will wait #milliseconds between retries. Default:1000. -
ha- Turn on high availability monitoring. Default:true. -
haInterval- Time between each replicaset status check. Default:10000,5000. -
replicaSet- The name of the replicaset to connect to. -
acceptableLatencyMS- 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. -
secondaryAcceptableLatencyMS- 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. -
connectWithNoPrimary- Sets if the driver should connect even if no primary is available. Default:false. -
authSource- If the database authentication is dependent on another databaseName. -
w- The write concern. -
wtimeout- The write concern timeout value. -
j- Specify a journal write concern. Default:false. -
forceServerObjectId- Force server to assign _id values instead of driver. Default:false. -
serializeFunctions- Serialize functions on any object. Default:false. -
ignoreUndefined- Specify if the BSON serializer should ignore undefined fields. Default:false. -
raw- Return document results as raw BSON buffers. Default:false. -
promoteLongs- Promotes Long values to number if they fit inside the 53 bits resolution. Default:true. -
promoteBuffers- Promotes Binary BSON values to native Node Buffers. Default:false. -
promoteValues- Promotes BSON values to native types where possible, set to false to only receive wrapper types. Default:true. -
domainsEnabled- Enable the wrapping of the callback in the current domain, disabled by default to avoid perf hit. Default:false. -
bufferMaxEntries- 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. -
readPreference- The preferred read preference.ReadPreference.PRIMARYReadPreference.PRIMARY_PREFERREDReadPreference.SECONDARYReadPreference.SECONDARY_PREFERREDReadPreference.NEAREST
-
pkFactory- A primary key factory object for generation of custom _id keys. -
promiseLibrary- A Promise library class the application wishes to use such as Bluebird, must be ES6 compatible. -
readConcern- Specify a read concern for the collection. (only MongoDB 3.2 or higher supported). -
maxStalenessSeconds- Specify a maxStalenessSeconds value for secondary reads, minimum is 90 seconds. -
appname- 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 -
loggerLevel- Specify the log level used by the driver logger (error/warn/info/debug). -
logger- Specify a customer logger mechanism, can be used to log using your app level logger. -
authMechanism- Sets the authentication mechanism that MongoDB will use to authenticate the connection.
sql.js data source options
-
database: The raw UInt8Array database that should be imported. -
sqlJsConfig: Optional initialize config for sql.js. -
autoSave: Whether or not autoSave should be disabled. If set to true the database will be saved to the given file location (Node.js) or LocalStorage element (browser) when a change happens andlocationis specified. OtherwiseautoSaveCallbackcan be used. -
autoSaveCallback: A function that get's called when changes to the database are made andautoSaveis enabled. The function gets aUInt8Arraythat represents the database. -
location: The file location to load and save the database to. -
useLocalForage: Enables the usage of the localforage library (https://github.com/localForage/localForage) to save & load the database asynchronously from the indexedDB instead of using the synchron local storage methods in a browser environment. The localforage node module needs to be added to your project and the localforage.js should be imported in your page.
expo data source options
database- Name of the database. For example, "mydb".driver- The Expo SQLite module. For example,require('expo-sqlite').
Data Source Options example
Here is a small example of data source options for mysql:
{
host: "localhost",
port: 3306,
username: "test",
password: "test",
database: "test",
logging: true,
synchronize: true,
entities: [
"entity/*.js"
],
subscribers: [
"subscriber/*.js"
],
entitySchemas: [
"schema/*.json"
],
migrations: [
"migration/*.js"
],
cli: {
entitiesDir: "entity",
migrationsDir: "migration",
subscribersDir: "subscriber"
}
}