Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/hex/src/data/mod.ts>MongoDbRepository

An ecosystem delivering practices, philosophy and portability.
Go to Latest
class MongoDbRepository
implements Repository<T>
import { MongoDbRepository } from "https://deno.land/x/hex@0.5.15/src/data/mod.ts";

Constructors

new
MongoDbRepository(connection: MongoDbConnection<T>, collectionName: string)

Type Parameters

optional
T = mongo.Bson.Document

Properties

collectionName: string
connection: MongoDbConnection

Methods

add<R = T>(data: R): Promise<string>
get(id: string): Promise<T | undefined>
getAll(): Promise<T[]>
getCollection(): Promise<mongo.Collection<T>>
remove(id: string): Promise<void>
replace<R = T>(id: string, data: R): Promise<void>
update<R = T>(id: string, data: R): Promise<void>