@condor-labs/mongodb
Advanced tools
Comparing version 1.1.0 to 1.1.1
{ | ||
"name": "@condor-labs/mongodb", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "This module provide and usefull helper to use mongoose library.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -16,9 +16,3 @@ This module provide and usefull helper to use mongoose library. | ||
```js | ||
npm install @condor-labs/mongodb | ||
``` | ||
@@ -36,46 +30,27 @@ | ||
| Property | Default | Description | | ||
| Property | Default | Description | | ||
| --------------------------------------------- | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| connectionName _(String)_ | | It is a unique value that will indentify the connection you are using | | ||
| host _(String)_ | `127.0.0.1` | The host name of the database you are connecting to. In case you want to connect to mongo Atlas via cluster. <br> A) You must check the connection metrics of your cluster. <br> B) Copy the hosts of your metrics and concatenate them in the host property of your connection configuration to mongo example: in its connection parameters. host: 'cluster0-shard-00-00.ksccs.mongodbnet'cluster0-shard-00-01.ksccs.mongodb.net,cluster0-shard-00-02.ksccs.mongodb.net' <br>keep in mind which host property receives one or multiple hosts. | | ||
| port _(Number)_ | `27017` | The port number to connect to. | | ||
| user _(String)_ | | The username for authentication. This option is mongoose-specific, they are equivalent to the MongoDB driver's auth.username options. | | ||
| password _(String)_ | | The password for authentication. This option is mongoose-specific, they are equivalent to the MongoDB driver's auth.password options. | | ||
| database _(String)_ | | Specifies which database to connect to and overrides any database specified in the connection string. | | ||
| replicaSet _(String)_ | | To connect to a single node replica set, specify the replicaSet option, see [Replica Set Host Names ](https://mongoosejs.com/docs/connections.html#replicaset-hostnames) | | ||
| ssl _(Boolean)_ | `false` | Flag to indicate the connection will use SSL | | ||
| authSource _(String)_ | | See [Replica Set Connections ](https://mongoosejs.com/docs/connections.html#replicaset_connections) | | ||
| ~~reconnectTries _(Number)_~~ (Deprecrated) | `30000` | If you're connected to a single server or mongos proxy (as opposed to a replica set), the MongoDB driver will try to reconnect every reconnectInterval milliseconds for reconnectTries times, and give up afterward. When the driver gives up, the mongoose connection emits a reconnectFailed event. This option does nothing for replica set connections. | | ||
| ~~reconnectInterval _(Number)_~~ (Deprecated) | `1000` | See `reconnectTries` | | ||
| readPreference _(String)_ | `secondaryPreferred` | Read preference describes how MongoDB clients route read operations to the members of a replica set. Possibles values: `primary`, `primaryPreferred`, `secondary`, `secondaryPreferred`, `nearest`.<br>**Docs:** https://docs.mongodb.com/manual/core/read-preference/ | | ||
|-----------|-----------|-------------| | ||
| connectionName _(String)_ | | It is a unique value that will indentify the connection you are using | ||
| host _(String)_ | `127.0.0.1` | The host name of the database you are connecting to. In case you want to connect to mongo Atlas via cluster. <br> A) You must check the connection metrics of your cluster. <br> B) Copy the hosts of your metrics and concatenate them in the host property of your connection configuration to mongo example: in its connection parameters. host: 'cluster0-shard-00-00.ksccs.mongodbnet'cluster0-shard-00-01.ksccs.mongodb.net,cluster0-shard-00-02.ksccs.mongodb.net' <br>keep in mind which host property receives one or multiple hosts.| | ||
| port _(Number)_ | `27017` | The port number to connect to.| | ||
| user _(String)_ | |The username for authentication. This option is mongoose-specific, they are equivalent to the MongoDB driver's auth.username options.| | ||
| password _(String)_| |The password for authentication. This option is mongoose-specific, they are equivalent to the MongoDB driver's auth.password options.| | ||
|database _(String)_| |Specifies which database to connect to and overrides any database specified in the connection string. | | ||
|replicaSet _(String)_| |To connect to a single node replica set, specify the replicaSet option, see [Replica Set Host Names ](https://mongoosejs.com/docs/connections.html#replicaset-hostnames)| | ||
|ssl _(Boolean)_| `false` |Flag to indicate the connection will use SSL| | ||
|authSource _(String)_| |See [Replica Set Connections ](https://mongoosejs.com/docs/connections.html#replicaset_connections)| | ||
|~~reconnectTries _(Number)_~~ (Deprecrated)| `30000` | If you're connected to a single server or mongos proxy (as opposed to a replica set), the MongoDB driver will try to reconnect every reconnectInterval milliseconds for reconnectTries times, and give up afterward. When the driver gives up, the mongoose connection emits a reconnectFailed event. This option does nothing for replica set connections.| | ||
|~~reconnectInterval _(Number)_~~ (Deprecated)| `1000` | See `reconnectTries`| | ||
|readPreference _(String)_| `secondaryPreferred` |Read preference describes how MongoDB clients route read operations to the members of a replica set. Possibles values: `primary`, `primaryPreferred`, `secondary`, `secondaryPreferred`, `nearest`.<br>**Docs:** https://docs.mongodb.com/manual/core/read-preference/ | ||
### ReadPreference Options | ||
| Property | Description | | ||
| Property | Description | | ||
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------- | | ||
| primary | All operations read from the current replica set primary. | | ||
| primaryPreferred | In most situations, operations read from the primary but if it is unavailable, operations read from secondary members. | | ||
| secondary | All operations read from the secondary members of the replica set. | | ||
| secondaryPreferred | In most situations, operations read from secondary members but if no secondary members are available, operations read from the primary. | | ||
| nearest | Operations read from member of the replica set with the least network latency, irrespective of the member’s type. | | ||
|-----------|-------------| | ||
| primary | All operations read from the current replica set primary.| | ||
| primaryPreferred | In most situations, operations read from the primary but if it is unavailable, operations read from secondary members.| | ||
| secondary | All operations read from the secondary members of the replica set.| | ||
| secondaryPreferred | In most situations, operations read from secondary members but if no secondary members are available, operations read from the primary.| | ||
| nearest | Operations read from member of the replica set with the least network latency, irrespective of the member’s type. | | ||
In case you want to connect to mongo Atlas via cluster, | ||
@@ -99,10 +74,8 @@ | ||
connectionName: "connection_mongo_1", | ||
host: "exapmle-shard-00-00-ac0ta.mongodb.net,exapmle-shard-00-01-ac0ta.mongodb.net,exapmle-shard-00-02-ac0ta.mongodb.net", | ||
host: "localhost", | ||
port: 27017, | ||
database: "development", | ||
user: "my-user", | ||
user: "local-user", | ||
password: "superSecretPass", | ||
replicaSet: "DevSupporApi-shard-0", | ||
ssl: true, | ||
authSource: "admin", | ||
ssl: false, | ||
}, | ||
@@ -109,0 +82,0 @@ { |
35258
185