- And
- Or
- Not
- Between
- Contains
- EndsWith
- EqualTo
- Exists
- FreeText
- GreaterThan
- GreaterThanOrEqualTo
- In
- LessThan
- LessThanOrEqualTo
- StartsWith
- DistanceWithin
This would return any document where first is 1 AND second is 2.
{
"where": [{
"and": [{
"field": "first",
"equalTo": 1
}, {
"field": "second",
"equalTo": 2
}]
}]
}
The And operator is the default logical operator and is not required to be specified explicitly.
{
"where": [{
"field": "first",
"equalTo": 1
}, {
"field": "second",
"equalTo": 2
}]
}
The example would return any document where first is 1 OR second is 2.
{
"where": [{
"or": [{
"field": "first",
"equalTo": 1
}, {
"field": "second",
"equalTo": 2
}]
}]
}
The not expects an inner operator so in the example any document where first is NOT equal to 7 would be returned.
{
"where": [{
"not": {
"field": "first",
"equalTo": 7
}
}]
}
In this example, if our field is between 18 and 45 inclusive it would match.
{
"where": [{
"field": "age",
"between": [18, 45]
}]
}
This would match on a field called description containing the phrase batman.
{
"where": [{
"field": "description",
"contains": "batman"
}]
}
This would find any item that has a field called wordField with a value ending with ing.
{
"where": [{
"field": "wordField",
"endsWith": "ing"
}]
}
This would find any item that has a field called blends with a value exactly matching 5. For string fields, the comparison is case-insensitive.
{
"where": [{
"field": "blends",
"equalTo": 5
}]
}
In the example any document that has a field called fieldName and would be returned. Documents where fieldName has some content would also be returned.
You can use a value of false if you want documents that do not contain a given field or where the field is empty or null.
{
"where": [{
"field": "fieldName",
"exists": true
}]
}
In the example the field synopsis is searched upon for any words that match gotham or dark or knight.
{
"where": [{
"field": "synopsis",
"freeText": "gotham dark knight"
}]
}
In the example any item that has a field called first and a value that is greater than 7 would be returned.
{
"where": [{
"field": "first",
"greaterThan": 7
}]
}
In the example any item that has a field called first and a value that is greater than or equal to 7 would be returned.
{
"where": [{
"field": "first",
"greaterThanOrEqualTo": 7
}]
}
In the example any document where the field first is equal to 1,7 or 11 would be returned. The values should be of the same type, in this case integer.
{
"where": [{
"field": "first",
"in": [1, 7, 11]
}]
}
In the example any item that has a field called first and a value that is less than 7 would be returned.
{
"where": [{
"field": "first",
"lessThan": 7
}]
}
In the example any item that has a field called first and a value that is less than or equal to 7 would be returned.
{
"where": [{
"field": "first",
"lessThanOrEqualTo": 7
}]
}
In the example if the name field contains a value starting with war it would match.
{
"where": [{
"field": "name",
"startsWith": "war"
}]
}
In the example any locations within a 10 mile radius of the specified location would match.
{
"where": [{
"field": "location",
"distanceWithin": {
"lat": "52.377",
"lon": "-2.749",
"distance": "10mi"
}
}]
}