Helper for setting up mongodb using mongoose for mimik microservices
js
import mongodb from '@mimik/mongooser';
`* mongooser
* _async_
* ~validate() ⇒ Promise
* _sync_
* ~getKMSProviders() ⇒ object
* ~initializeSync(autoEncryption) ⇒ object
* ~replicat() ⇒ boolean
$3
Database connection validation.Kind: inner method of mongooser
Returns: Promise - .
Category: async
Throws:
- Promise Will throw an error if the database connection is not
connected.Will exit 1 if the connection request times out and the connection state is not
connected.Requires: module:@mimik/sumologic-winston-logger
Fulfil: Return
null.
$3
AutoEncryption KMSProvider.Kind: inner method of mongooser
Returns: object - The KMSProviders object.
Will return the kmsProvider settings for the service.
Category: sync
$3
Database initialization.Kind: inner method of mongooser
Returns: object - The database object.
The autoEncryption has the following strucuture:
` javascript
{
"keyVaultClient" : `
Check MongoDB documentation for more details. https://docs.mongodb.com/manual/reference/method/Mongo/#clientsidefieldlevelencryptionoptionsWill exit 1 if the connection request generates an error or the connection state is
disconnected or disconnecting.
Category: sync
Requires: module:sumologic-winston-logger | Param | Type | Description |
| --- | --- | --- |
| autoEncryption | object | Encryption settings for mongo connection. |
$3
Indicates if the replica is set.Kind: inner method of mongooser
Returns: boolean -
True if replica is set, False` if not.