Provided by [Stagg.co](https://stagg.co)
npm install @stagg/mongo
yarn install @stagg/mongo
`
Configure the connection on startup (only done once).
`typescript
import * as Mongo from '@stagg/mongo'
(async () => {
const cfg:Mongo.Config = {...}
Mongo.config(cfg)
const db = await Mongo.client()
// ... do stuff
})()
`
In any subsequent requests, only the client needs to be fetched.
`typescript
import * as Mongo from '@stagg/mongo'
(async () => {
const db = await Mongo.client()
// ... do stuff
})()
`
The config interface can be found in
`typescript
export interface Config {
db:string
host:string
user:string
password:string
}
``