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

0.2.2 • Public • Published

mutent-couchdb

CouchDB adapter for Mutent.

import { Store } from 'mutent'
import CouchAdapter from 'mutent-couchdb'

const store = new Store({
  adapter: new CouchAdapter({
    databaseName: 'my-docs',
    nanoOptions: {
      url: 'http://127.0.0.1:5984/'
    }
  })
})

// Mango query by default
const mangoDoc = await store.find({ with: 'mango' }).unwrap()
if (mangoDoc) {
  console.log(`doc ${mangoDoc._id} found using mango`)
}

// Use _design and _view props to specify view queries
const viewDoc = store.find({
  _design: 'default',
  _view: 'by_hello',
  key: 'view'
}).unwrap()
if (viewDoc) {
  console.log(`doc ${viewDoc._id} found using view`)
}

Package Sidebar

Install

npm i mutent-couchdb

Weekly Downloads

5

Version

0.2.2

License

MIT

Unpacked Size

14.2 kB

Total Files

6

Last publish

Collaborators

  • greguz