@marcj/marshal-mongo
TypeScript icon, indicating that this package has built-in type declarations

2.1.13 • Public • Published

Mongo Database for Marshal

npm version

Marshal's MongoDB database abstraction makes it super easy to retrieve and store data from and into your MongoDB. We make sure the data from your JSON or class instance is correctly converted to MongoDB specific types and inserted IDs are applied to your class instance.

npm install @marcj/marshal @marcj/marshal-mongo reflect-metadata mongodb
import {Database, Connection} from "@marcj/marshal-mongo";

const database = new Database(new Connection('localhost', 'mydb', 'username', 'password'));

const instance = new SimpleModel('My model');
await database.add(instance);

const list = await database.query(SimpleModel).find();
const oneItem = await database.query(SimpleModel).filter({id: 'f2ee05ad-ca77-49ea-a571-8f0119e03038'}).findOne();

Readme

Keywords

none

Package Sidebar

Install

npm i @marcj/marshal-mongo

Weekly Downloads

14

Version

2.1.13

License

MIT

Unpacked Size

150 kB

Total Files

30

Last publish

Collaborators

  • marcj