# monquery

> mongo query language for humans inspired by Lucene

Latest version **0.2.0** (published 2014-10-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install monquery
pnpm add monquery
yarn add monquery
bun add monquery
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2014-10-11 |
| First published | 2014-02-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 103 |
| Maintainers | tjholowaychuk |
| Keywords | lucene, mongo, mongodb, query, language |

## Links

- npm: https://www.npmjs.com/package/monquery
- Repository: https://github.com/visionmedia/node-monquery
- Issues: https://github.com/visionmedia/node-monquery/issues
- npm.io page: https://npm.io/package/monquery

## Dependencies (1)

- [escape-regexp](https://npm.io/package/escape-regexp.md) 0.0.1

## Alternatives

- [angular-pipes](https://npm.io/package/angular-pipes.md) — 5.6K weekly downloads
- [@ng-web-apis/midi](https://npm.io/package/@ng-web-apis/midi.md) — 2.6K weekly downloads
- [happn-3](https://npm.io/package/happn-3.md) — 1.6K weekly downloads
- [@opensip-cli/lang-go](https://npm.io/package/@opensip-cli/lang-go.md) — 1.2K weekly downloads
- [@temporal-architect/claude-plugin](https://npm.io/package/@temporal-architect/claude-plugin.md) — 335 weekly downloads

## Recent versions

- 0.2.0 (latest) — 2014-10-11
- 0.1.0 — 2014-02-11
- 0.0.1 — 2014-02-05

## README

# monquery

  Lucene-inspired string-based mongodb query language for humans (and ferrets).

## Installation

```
$ npm install monquery
```

## Why?

  1. Nicer UX for the odd search / log filtering
  2. Writing JSON queries is a PITA

## Example

```js
var compile = require('monquery');
var str = 'level:error OR type:upload';
var query = compile(str);
```

## Querying

### Fields

  Specify field names with optional values:

```js
level:error
```

yields

```js
{ level: 'error' }
```

### Booleans

  Omit value to imply __true__:

```js
failed
```

yields

```js
{ failed: true }
```

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

```js
failed: no
```

yields

```js
{ failed: false }
```

### Operators

  Currently supports __AND__ / __OR__, which may be nested:

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

yields

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

### Regular Expressions

  Regexps may be used with the `//` syntax:

```js
level:info AND name:/^To/
```

yields

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

### Patterns

  Wildcards may be used to generate regular expressions:

```js
level:error AND hostname:api-*
```

yields

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

# License

  MIT

---
_Source: https://npm.io/package/monquery · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
