New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

humanquery

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

humanquery

Mongoose query language for humans inspired by Lucene

unpublished
latest
npmnpm
Version
0.1.0
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

HumanQuery

Lucene-inspired string-based mongodb query language for humans (and ferrets). And implemention in Mongoose

Installation

$ npm install humanquery

Why?

  • Nicer UX for the odd search / log filtering
  • Writing JSON queries is a PITA

Example

var mongoose = require('mongoose');
require('humanquery')( mongoose );

Query

model.findOne().query('level:error OR type:upload', function(err, doc){
  // More Code..
});
model.query('level:error OR type:upload').count(function(err, doc){
  // More Code..
});

Querying

Fields

Specify field names with optional values:

level:error

yields

{ level: 'error' }

Booleans

Omit value to imply true:

failed

yields

{ failed: true }

Or specify a boolean-ish value (true, false, yes, no):

failed: no

yields

{ failed: false }

Operators

Currently supports AND / OR, which may be nested:

(level:error AND type:"upload failed") OR user.name.first:Tobi

yields

{ '$or':
   [ { '$and': [ { level: 'error' }, { type: 'upload failed' } ] },
     { 'user.name.first': 'Tobi' } ] }

Regular Expressions

Regexps may be used with the // syntax:

level:info AND name:/^To/

yields

{ '$and': [ { level: 'info' }, { name: /^To/ } ] }

Patterns

Wildcards may be used to generate regular expressions:

level:error AND hostname:api-*

yields

{ '$and': [ { level: 'error' }, { hostname: /^api-.*$/ } ] }

License

MIT

Keywords

lucene

FAQs

Package last updated on 13 Apr 2014

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