Attributes
Includes Deno configuration
Repository
Current version released
4 years ago
Dependencies
deno.land/x
π₯ Mango
Lightweight abstraction layer on top of mongodb driver to provide following features.
Features
β
_id mapping to id
β
_id transformation from ObjectId to string. So you will work always with strings and mongo will store ObjectId. You will not need to worry about conversions any more.
β
Versioning system can be enabled per collection. version: number and its increased by 1 every time you call update
β
Doc Dates can be enabled per collection and documents will have createdAt and updatedAt
Example:
import {
connectMongo,
MangoRepo,
} from 'https://deno.land/x/jok_mango@v0.1.1/mod.ts'
const { db } = await connectMongo('mongo://localhost/test')
const repo = new MangoRepo<{ name: string; avatarUrl: string }>(
db,
'users',
)
const result = await repo.insertOne({
name: 'playerx',
avatarUrl: 'myJokAvatar',
})
console.log(result)