linhe0x0 / mongos

An opinionated mongoose wrapper.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

An opinionated mongoose wrapper.

License:MIT License


Languages

Language:TypeScript 98.3%Language:JavaScript 1.7%