4.1.0 • Published 5 years ago
monglow v4.1.0
monglow
A simple MongoDB wrapper that doesn't get in your way.
- Easy & flexible database setup
- Command buffering (query without waiting for connection)
- Promises built-in
- Direct access to native MongoDB driver
- Serverless friendly
- Typescript support
npm i --save monglow
Usage
import { Monglow, Model } from 'monglow';
const uri = 'localhost/test';
const monglow = new Monglow(uri);
interface IUser {
firstName: string;
lastName: string;
}
const User = new Model<IUser>('users');
/**
* You can activate and use your models at any point in the code and
* Monglow will automatically handle the connection process
*/
monglow.activate(User);
User.find().then(users => {
console.log(users);
});
// Direct access to MongoDB driver
User.collection.then(c => c.find({ hello: 'world!' }).count());
// You can also activate models with connectAndActivate so
// you don't need to run connect at the start of the code.
monglow.connectAndActivate(User);
// Note: this function can be called many times without
// any problems, the database will only connect once per instance of Monglow
monglow.connect();
//
//
// Do some things
//
//
monglow.close();
4.1.0
5 years ago
4.0.0
5 years ago
3.3.1
5 years ago
3.3.0
5 years ago
3.2.2
6 years ago
3.2.1
6 years ago
3.2.0
6 years ago
3.1.0
6 years ago
3.0.2
6 years ago
3.0.1
6 years ago
3.0.0
6 years ago
2.3.2
6 years ago
2.3.1
6 years ago
2.3.0
6 years ago
2.2.2
6 years ago
2.2.1
6 years ago
2.2.0
6 years ago
2.1.5
6 years ago
2.1.4
6 years ago
2.1.3
6 years ago
2.1.2
6 years ago
2.1.1
6 years ago
2.1.0
6 years ago
2.0.1
6 years ago
2.0.0
6 years ago
1.4.2
6 years ago
1.4.1
6 years ago
1.4.0
6 years ago
1.3.1
6 years ago
1.3.0
6 years ago
1.2.0
6 years ago
1.1.3
6 years ago
1.1.2
6 years ago
1.1.1
6 years ago
1.1.0
6 years ago
1.0.0
6 years ago