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
Basic Example:
import { connectMongo, MangoRepo } from 'https://deno.land/x/jok_mango@v1.3.0/mod.ts'
type User = {
name: string
avatarUrl: string
}
const { db } = await connectMongo('mongo://localhost/test')
const repo = new MangoRepo<User>(
db,
'users',
)
const result = await repo.insert({
name: 'playerx',
avatarUrl: 'myJokAvatar',
})
console.log(result)