Skip to content
Angel Alvarado edited this page Nov 18, 2015 · 6 revisions

API

Here is a list of chain-able methods, details coming soon...

Every query must start with .select() this is used to reset the internal matched values

.select()
.select("first", "last")

.where() is case sensitive

.where("first", "Angel")
.where({"first": "Angel", "city": "Atlanta"}) // AND
.where({"first": "Angel", "city": "Atlanta"}, {"city": "New York"}, , {"city": "Jacksonville"}) // OR

.in/.notIn case sensitive

.in('age', [18, 21, 65])
.notIn('city', ["New York", "Orlando"])
.lt("age", 18)
.lte("age", 18)
.gt("age", 18)
.gte("age", 18)

.between is inclusive except when true is passed in as an optional argument

.between("age", 18, 21) // inclusive
.between("age", 18, 21, true) // exclusive

.regEx uses regular expression as a second argument, case sensitive

.regEx("first", /^m|M.*s$/)

The following are all case insensitive

.like("city", "grove")
.startsWith("city", "st")
.endsWith("email", ".com")

Various ways to sort

.sortBy("age")
.sortBy("age", "asc")
.sortBy("age", "desc")
.sortBy({"name": "asc", "age": "desc})
.sortAsc("name")
.sortDesc("age")

Returns the number of elements

.count()

Works like SQL limit(limit, offset)

.limit(10)
.limit(10, 20)

Returns elements that match the query, can be used multiple times throughout chaining

.get()
Clone this wiki locally