miego
v0.1.1
Published
Better way to use mongoDB
Downloads
10
Readme
MIEGO
Miego is MongoDB native driver + more facilities!
Features
Populates: Miego supports all kind of document populations. (Nested populate, Array populate, Cross database/service populate)
Pagination: Pagination will be very convenient, no more plugins
No risk: By using Miego useNative()
method, You can use ALL mongodb native operations without any changes
Reliable: Miego will never use any deprecated Mongodb methods!
Performance: Blazing fast! 4x faster than Mongoose!
Better structure: No more Mongoose document, pseudo Promise , lean()
, toObject()
, and other mongoose sucks
Best choose for Typescript: You can use interfaces as a generic for Collection class
Hello World
It's easy to use.
First you need setup connection via MongoClient
:
import { Collection, MongoClient } from 'miego'
const client = new MongoClient('mongodb://localhost:27017')
await client.connect()
Next, Creating collections: JS:
const users = new Collection('users', {
client
})
TS:
interface User {
name: string
}
users = new Collection<User>('users', { client })
Use it😅:
const user = await users.insertOne({
entity: { name: 'Erfan' }
})
Contributors
Pull requests are always welcome!