An opinionated mongoose wrapper.
npm install @sqrtthree/mongos
import Mongos from '@sqrtthree/mongos'
const mongo = new Mongos(dbConfig: DBConfig, config?: Config, connectOptions?: ConnectOptions)
mongo.connection.model('User', userSchema)
The Object will be formatted to Standard Connection String Format string with sqrthree/mongoose-helper.
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
.
A logger used to output event messages.
See mongoosejs.com/docs/connections.html#options to get more details.
sqrtthree.com · GitHub @sqrthree · Twitter @sqrtthree