wql
wql is a WHERE clause generator for WQL queries using MongoDB syntax.
Installation
npm i --save wql
Examples
;
Simple matching
;
output
propString = "str" AND propLike like "%foo%" AND propNumber > 1 AND propBool = true
Arrays (in)
;
output
(foo = 1 OR foo = 2 OR foo = 5 OR foo = 10)
Arrays (not in)
;
output
(foo != 1 AND foo != 2 AND foo != 5 AND foo != 10)
AND
;
output
(foo1 = 1 AND bar1 = "a") AND (foo2 = 2 AND bar2 = "b")
OR
;
output
(foo1 = 1 AND bar1 = "a") OR (foo2 = 2 AND bar2 = "b")
Nested queries
output
(foo1 = 1 AND bar1 = "a") AND ((a = 1 AND c = 1) OR (b = 2 AND c = 1))
Supported operators
$ne
$eq
$gte
$lte
$gt
$lt
$in
$nin
$like
$startsWith
MIT License
Copyright (c) 2016 Łukasz Sentkiewicz