mutent-mongodb
TypeScript icon, indicating that this package has built-in type declarations

0.13.1 • Public • Published

mutent-mongodb

npm JavaScript Style Guide

Mutent's adapter for MongoDB.

import { MongoClient } from 'mongodb'
import { Store } from 'mutent'
import { MongoAdapter } from 'mutent-mongodb'

const client = new MongoClient(process.env.MONGO_URL)

await client.connect()

const store = new Store({
  adapter: new MongoAdapter({
    client,
    dbName: 'my-database',
    collectionName: 'my-collection'
  })
})

const doc = await store
  .create({ my: 'document' })
  .unwrap()

console.log(`Created document ${doc._id}`)

Package Sidebar

Install

npm i mutent-mongodb

Weekly Downloads

9

Version

0.13.1

License

MIT

Unpacked Size

28 kB

Total Files

8

Last publish

Collaborators

  • greguz