@wxn0brp/db-storage-mongodb
v0.111.2
Published
A ValtheraDB compatible storage adapter that uses MongoDB as a backend.
Maintainers
Readme
ValtheraDB-storage-mongodb
A ValtheraDB compatible storage adapter that uses MongoDB as a backend.
This allows you to use the ValtheraDB API and its relational engine with a powerful and scalable MongoDB database.
Installation
bun i @wxn0brp/db-storage-mongodbUsage
import { ValtheraClass } from "@wxn0brp/db-core";
import { MongoDbAction } from "@wxn0brp/db-storage-mongodb";
const MONGO_URI = "mongodb://localhost:27017";
const DB_NAME = "my-app-db";
const actions = new MongoDbAction(MONGO_URI, DB_NAME);
const db = new ValtheraClass({ dbAction: actions });
try {
const newUser = await db.c("users").add({ name: "John Doe", age: 30 });
console.log(newUser);
} finally {
await db.close();
}License
MIT
