0.0.4 • Published 8 years ago

jouch v0.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
8 years ago

Build Status

A couchdb 2.0 query parser, using jison

Installation

npm install --save jouch

Usage

PouchDB

import parse from 'jouch'
import PouchDB from 'pouchdb'
import pouchdb-find from 'pouchdb-find'

PouchDB.plugin(pouchdb-find)
const db = new PouchDB('/path/to/pouch')

const selector = parse('id != null')
db.find({
  selector: selector
}).then(res => {
  // results
})

CouchDB 2.0

// TODO: add couchdb usage example

Expressions

expressionresult
==$eq
!=$ne
>=$gte
<=$lte
>$gt
<$lt
and$and
or$or
not$not
has$elemMatch

e.g.

const selector = jouch('age >= 18 and skills has "javascript"')

would parse to

{ "$and": [
    { "age": {"$gte": 18}},
    { "$elemMatch": {"skills": {"$eq": "javascript"}}}
   ]
}
0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago