|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.vz.mongodb.jackson.DBQuery
public class DBQuery
Builder for MongoDB queries.
The primary way in which this case is used is by calling the below methods onDBCursor
, which is an instance
if the Builder. The static methods on this class may be used when passing in expressions to and(), or() etc.
Any values that are not basic objects (numbers, Strings, booleans, collections etc) that are passed in are attempted
to be serialised using Jackson.
Caution needs to be taken when querying entries that are objectIds. The mapper is at this stage unaware whether a
field is stored as an ObjectId or not, so you must pass in any values that are stored as ObjectId as type
ObjectId
.
Nested Class Summary | |
---|---|
static class |
DBQuery.AbstractBuilder<Q extends DBQuery.AbstractBuilder>
|
static class |
DBQuery.Query
This is a query builder that is also a valid query that can be passed to MongoDB |
Constructor Summary | |
---|---|
DBQuery()
|
Method Summary | |
---|---|
static DBQuery.Query |
all(String field,
Collection<?> values)
The array field contains all of the given values |
static DBQuery.Query |
all(String field,
Object... values)
The array field contains all of the given values |
static DBQuery.Query |
and(DBQuery.Query... expressions)
All of the given expressions match |
static DBQuery.Query |
elemMatch(String field,
DBQuery.Query query)
An element in the given array field matches the given query |
static DBQuery.Query |
exists(String field)
The given field exists |
static DBQuery.Query |
greaterThan(String field,
Object value)
The field is greater than the given value |
static DBQuery.Query |
greaterThanEquals(String field,
Object value)
The field is greater than or equal to the given value |
static DBQuery.Query |
in(String field,
Collection<?> values)
The field is in the given set of values |
static DBQuery.Query |
in(String field,
Object... values)
The field is in the given set of values |
static DBQuery.Query |
is(String field,
Object value)
The field is equal to the given value |
static DBQuery.Query |
lessThan(String field,
Object value)
The field is less than the given value |
static DBQuery.Query |
lessThanEquals(String field,
Object value)
The field is less than or equal to the given value |
static DBQuery.Query |
mod(String field,
Number mod,
Number value)
The field, modulo the given mod argument, is equal to the value |
static DBQuery.Query |
nor(DBQuery.Query... expressions)
None of the given expressions match |
static DBQuery.Query |
notEquals(String field,
Object value)
The field is not equal to the given value |
static DBQuery.Query |
notExists(String field)
The given field doesn't exist |
static DBQuery.Query |
notIn(String field,
Collection<?> values)
The field is not in the given set of values |
static DBQuery.Query |
notIn(String field,
Object... values)
The field is not in the given set of values |
static DBQuery.Query |
or(DBQuery.Query... expressions)
One of the given expressions matches |
static DBQuery.Query |
regex(String field,
Pattern regex)
The given field matches the regular expression |
static DBQuery.Query |
size(String field,
int size)
The array field is of the given size |
static DBQuery.Query |
where(String code)
Execute the given JavaScript code as part of the query |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DBQuery()
Method Detail |
---|
public static DBQuery.Query is(String field, Object value)
field
- The field to comparevalue
- The value to compare to
public static DBQuery.Query lessThan(String field, Object value)
field
- The field to comparevalue
- The value to compare to
public static DBQuery.Query lessThanEquals(String field, Object value)
field
- The field to comparevalue
- The value to compare to
public static DBQuery.Query greaterThan(String field, Object value)
field
- The field to comparevalue
- The value to compare to
public static DBQuery.Query greaterThanEquals(String field, Object value)
field
- The field to comparevalue
- The value to compare to
public static DBQuery.Query notEquals(String field, Object value)
field
- The field to comparevalue
- The value to compare to
public static DBQuery.Query in(String field, Object... values)
field
- The field to comparevalues
- The value to compare to
public static DBQuery.Query in(String field, Collection<?> values)
field
- The field to comparevalues
- The value to compare to
public static DBQuery.Query notIn(String field, Object... values)
field
- The field to comparevalues
- The value to compare to
public static DBQuery.Query notIn(String field, Collection<?> values)
field
- The field to comparevalues
- The value to compare to
public static DBQuery.Query mod(String field, Number mod, Number value)
field
- The field to comparemod
- The modulovalue
- The value to compare to
public static DBQuery.Query all(String field, Collection<?> values)
field
- The field to comparevalues
- The values to compare to
public static DBQuery.Query all(String field, Object... values)
field
- The field to comparevalues
- The values to compare to
public static DBQuery.Query size(String field, int size)
field
- The field to comparesize
- The value to compare
public static DBQuery.Query exists(String field)
field
- The field to check
public static DBQuery.Query notExists(String field)
field
- The field to check
public static DBQuery.Query or(DBQuery.Query... expressions)
expressions
- The expressions to test
public static DBQuery.Query and(DBQuery.Query... expressions)
expressions
- The expressions to test
public static DBQuery.Query nor(DBQuery.Query... expressions)
expressions
- The expressions to test
public static DBQuery.Query regex(String field, Pattern regex)
field
- The field to comareregex
- The regular expression to match with
public static DBQuery.Query elemMatch(String field, DBQuery.Query query)
field
- the array fieldquery
- The query to attempt to match against the elements of the array field
public static DBQuery.Query where(String code)
code
- the JavaScript code
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |