1.2.0 • Published 1 year ago
@sqrtthree/mongos v1.2.0
mongos
An opinionated mongoose wrapper.
Install
npm install @sqrtthree/mongos
Usage
import Mongos from '@sqrtthree/mongos'
const mongo = new Mongos(dbConfig: DBConfig, config?: Config, connectOptions?: ConnectOptions)
mongo.connection.model('User', userSchema)
Options
DBConfig: Object
The Object will be formatted to Standard Connection String Format string with sqrthree/mongoose-helper.
Config.lazyConnect: boolean
By default, When a new Mongos instance is created, it will connect to MongoDB server automatically. If you want to keep the instance disconnected until call connect
manually, you can pass the lazyConnect option to the true
.
Config.logger: Object
A logger used to output event messages.
ConnectOptions
See mongoosejs.com/docs/connections.html#options to get more details.
sqrtthree.com · GitHub @sqrthree · Twitter @sqrtthree