Skip to content

JSON Document store with flexible backend (files on fs, PouchDB, etc).

License

Notifications You must be signed in to change notification settings

interop-alliance/flex-docstore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flexible Document Store (flex-docstore)

JSON Document store with flexible backend (files on fs, PouchDB, etc)

Table of Contents

Security

TBD

Background

TBD

Install

Requires Node.js 8.10+.

npm install flex-docstore

Usage

Requiring

const { FlexDocStore } = require('flex-docstore')

FS Backend (one file per object)

const store = FlexDocStore.using('files', { dir: './db' })

Mock Backend (for unit testing)

const store = FlexDocStore.using('mock')

API

The storage API is based on the PouchDB API

  • post is not implemented (use uuid + put)
get

async get (key)

Retrieves the document at a given key (null if not found).

const data = await store.get('key1')
put

async put (key, value)

Writes a document to a given key.

await store.put('key1', doc)
remove

async remove (key)

Deletes a document.

await store.remove('key1')
allDocs

async allDocs ()

Lists all documents in the store.

await store.allDocs({ include_docs: false })

Contribute

PRs accepted.

Code style: Standard JS

Comments style: JSDoc.

README style: If editing the Readme, please conform to the standard-readme specification.

License

MIT LICENSE © Interop Alliance, Dmitri Zagidulin

About

JSON Document store with flexible backend (files on fs, PouchDB, etc).

Resources

License

Stars

Watchers

Forks

Packages

No packages published