Database
@jbkr/db-client
Client for databases in the jbkr cluster in MongoDB Atlas.
Source: modules/db-client/index.js
API
Public : Function :
returnDatabaseConnection
Return a MongoDB Client connected to the specified database in the MongoDB Atlas jbkr cluster.
Type Definitions
MongoDBClient
A Node.js MongoDB client, from the official MongoDB NodeJS Driver module.
| Name | Type | Description |
|---|---|---|
| db | function | Represents a MongoDB database |
| collection | function | Embodies a MongoDB collection allowing for insert/update/remove/find and other command operation on that MongoDB collection |
Parameters
| Name | Type | Description |
|---|---|---|
| {} | Object | Destructured parameters |
| {}.dbName | Object | Name of database to which to connect. |
Return
Returns: MongoDBClient — A MongoDB Client connected to the specified database in the MongoDB Atlas jbkr cluster.
Examples
import { returnDatabaseConnection } from '@jbkr/db-client';
const dbConnection = await returnDatabaseConnection({
'dbName': process.env.mongoDbDbName,
});
const data = await dbConnection.collection('collectionName').findOne({});
Source: modules/db-client/index.js:53
Inner Elements
Private : Function :
returnMongoConnection
Return a MongoDB Client connected to the MongoDB Atlas jbkr cluster.
Type Definitions
MongoDBClient
A Node.js MongoDB client, from the official MongoDB NodeJS Driver module.
| Name | Type | Description |
|---|---|---|
| db | function | Represents a MongoDB database |
| collection | function | Embodies a MongoDB collection allowing for insert/update/remove/find and other command operation on that MongoDB collection |
Return
Returns: MongoDBClient — A MongoDB Client connected to the MongoDB Atlas jbkr cluster.
Source: modules/db-client/index.js:28