New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

jouch

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jouch

couchdb query parser

0.0.4
latest
npm
Version published
Maintainers
1
Created
Source

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"}}}
   ]
}

FAQs

Package last updated on 27 May 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts