public interface Query<T> extends Cloneable
Query q= Morphium.get().createQueryFor(UncachedObject.class);
q=q.f("counter").lt(15).f("counter").gt(10);
Or
q.or(q.q().f("counter").eq(15),q.q().f("counter").eq(22));
AND is the default!| Modifier and Type | Interface and Description |
|---|---|
static class |
Query.TextSearchLanguages |
| Modifier and Type | Method and Description |
|---|---|
Query<T> |
addChild(FilterExpression e)
needed for creation of the query representation tree
|
Query<T> |
addProjection(Enum f) |
Query<T> |
addProjection(Enum f,
String projectOperator) |
Query<T> |
addProjection(String f) |
Query<T> |
addProjection(String f,
String projectOperator) |
Query<T> |
addTag(String name,
String value) |
MorphiumQueryIterator<T> |
asIterable()
create an iterator / iterable for this query, default windowSize (10), prefetch windows 1
|
MorphiumQueryIterator<T> |
asIterable(int windowSize)
create an iterator / iterable for this query, sets window size (how many objects should be read from DB)
prefetch number is 1 in this case
|
MorphiumQueryIterator<T> |
asIterable(int windowSize,
Class<? extends MorphiumQueryIterator<T>> it) |
MorphiumQueryIterator<T> |
asIterable(int windowSize,
int prefixWindows)
create an iterator / iterable for this query, sets window size (how many entities are read en block) and how many windows of this size will be prefechted...
|
MorphiumQueryIterator<T> |
asIterable(MorphiumQueryIterator<T> ret) |
List<T> |
asList()
the result as list
|
void |
asList(AsyncOperationCallback<T> callback) |
MorphiumQueryIterator<Map<String,Object>> |
asMapIterable() |
List<Map<String,Object>> |
asMapList() |
Query<T> |
clone() |
List<T> |
complexQuery(Map<String,Object> query)
Deprecated.
|
List<T> |
complexQuery(Map<String,Object> query,
Map<String,Integer> sort,
int skip,
int limit)
Deprecated.
|
List<T> |
complexQuery(Map<String,Object> query,
String sort,
int skip,
int limit)
Deprecated.
|
long |
complexQueryCount(Map<String,Object> query)
Deprecated.
|
T |
complexQueryOne(Map<String,Object> query)
Deprecated.
|
T |
complexQueryOne(Map<String,Object> query,
Map<String,Integer> sort)
Deprecated.
|
T |
complexQueryOne(Map<String,Object> query,
Map<String,Integer> sort,
int skip)
Deprecated.
|
long |
countAll()
count all results in query - does not take limit or skip into account
|
void |
countAll(AsyncOperationCallback<T> callback) |
void |
dec(Enum field,
Double value) |
void |
dec(Enum field,
Double value,
boolean upsert,
boolean multiple) |
void |
dec(Enum field,
Double value,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> cb) |
void |
dec(Enum field,
Integer value) |
void |
dec(Enum field,
Integer value,
boolean upsert,
boolean multiple) |
void |
dec(Enum field,
Integer value,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> cb) |
void |
dec(Enum field,
Long value) |
void |
dec(Enum field,
Long value,
boolean upsert,
boolean multiple) |
void |
dec(Enum field,
Long value,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> cb) |
void |
dec(Enum field,
Number value) |
void |
dec(Enum field,
Number value,
boolean upsert,
boolean multiple) |
void |
dec(Enum field,
Number value,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> cb) |
void |
dec(String field,
Double value) |
void |
dec(String field,
Double value,
boolean upsert,
boolean multiple) |
void |
dec(String field,
Double value,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> cb) |
void |
dec(String field,
Integer value) |
void |
dec(String field,
Integer value,
boolean upsert,
boolean multiple) |
void |
dec(String field,
Integer value,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> cb) |
void |
dec(String field,
Long value) |
void |
dec(String field,
Long value,
boolean upsert,
boolean multiple) |
void |
dec(String field,
Long value,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> cb) |
void |
dec(String field,
Number value) |
void |
dec(String field,
Number value,
boolean upsert,
boolean multiple) |
void |
dec(String field,
Number value,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> cb) |
void |
delete() |
Query<T> |
disableAutoValues() |
List |
distinct(String field) |
Query<T> |
enableAutoValues() |
Query<T> |
expr(Expr exp) |
MongoField<T> |
f(Enum... f) |
MongoField<T> |
f(Enum field)
same as f(field.name())
|
MongoField<T> |
f(String... f) |
MongoField<T> |
f(String f)
Get a field.
|
T |
findOneAndDelete() |
T |
findOneAndUpdate(Map<String,Object> update) |
T |
findOneAndUpdateEnums(Map<Enum,Object> update) |
T |
get()
get only 1 result (first one in result list)
|
void |
get(AsyncOperationCallback<T> callback) |
AnnotationAndReflectionHelper |
getARHelper() |
T |
getById(Object id)
Deprecated.
|
void |
getById(Object id,
AsyncOperationCallback<T> callback)
Deprecated.
|
Collation |
getCollation() |
String |
getCollectionName() |
String |
getDB()
return the DB name the query is going to be executed on or was executed on
|
Map<String,Object> |
getFieldListForQuery() |
int |
getLimit() |
Morphium |
getMorphium() |
int |
getNumberOfPendingRequests() |
ReadPreferenceLevel |
getReadPreferenceLevel() |
String |
getServer()
returns the serveraddress the query was executed on
|
int |
getSkip() |
Map<String,Integer> |
getSort() |
String[] |
getTags() |
Class<? extends T> |
getType()
what type this query is for
|
String |
getWhere() |
Query<T> |
hideFieldInProjection(Enum f) |
Query<T> |
hideFieldInProjection(String f) |
<R> List<R> |
idList()
only return the IDs of objects (useful if objects are really large)
|
void |
idList(AsyncOperationCallback<T> callback) |
void |
inc(Enum field,
Double value) |
void |
inc(Enum field,
Double value,
boolean upsert,
boolean multiple) |
void |
inc(Enum field,
Double value,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> cb) |
void |
inc(Enum field,
Integer value) |
void |
inc(Enum field,
Integer value,
boolean upsert,
boolean multiple) |
void |
inc(Enum field,
Integer value,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> cb) |
void |
inc(Enum field,
Long value) |
void |
inc(Enum field,
Long value,
boolean upsert,
boolean multiple) |
void |
inc(Enum field,
Long value,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> cb) |
void |
inc(Enum field,
Number value) |
void |
inc(Enum field,
Number value,
boolean upsert,
boolean multiple) |
void |
inc(Enum field,
Number value,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> cb) |
void |
inc(String field,
Double value) |
void |
inc(String field,
Double value,
boolean upsert,
boolean multiple) |
void |
inc(String field,
Double value,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> cb) |
void |
inc(String field,
Integer value) |
void |
inc(String field,
Integer value,
boolean upsert,
boolean multiple) |
void |
inc(String field,
Integer value,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> cb) |
void |
inc(String field,
Long value) |
void |
inc(String field,
Long value,
boolean upsert,
boolean multiple) |
void |
inc(String field,
Long value,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> cb) |
void |
inc(String field,
Number value) |
void |
inc(String field,
Number value,
boolean upsert,
boolean multiple) |
void |
inc(String field,
Number value,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> cb) |
boolean |
isAutoValuesEnabled() |
Query<T> |
limit(int i)
limit the number of entries in result
|
Query<T> |
matchesJsonSchema(Map<String,Object> schemaDef) |
Query<T> |
matchesJsonSchema(String schemaDef) |
Query<T> |
nor(Query<T>... q)
not or
|
Query<T> |
or(List<Query<T>> q)
concatenate those queries with or
|
Query<T> |
or(Query<T>... q)
concatenate those queries with or
|
void |
overrideDB(String db)
use this db instead of the default one
|
void |
pull(Enum field,
Expr value) |
void |
pull(Enum field,
Expr value,
boolean upsert,
boolean multiple) |
void |
pull(Enum field,
Expr value,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> cb) |
void |
pull(Enum field,
Object value) |
void |
pull(Enum field,
Object value,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> cb) |
void |
pull(String field,
Object value) |
void |
pull(String field,
Object value,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> cb) |
void |
pullAll(Enum field,
List value) |
void |
pullAll(Enum field,
List value,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> cb) |
void |
pullAll(String field,
List value) |
void |
pullAll(String field,
List value,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> cb) |
void |
push(Enum field,
Object value) |
void |
push(Enum field,
Object value,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> cb) |
void |
push(String field,
Object value) |
void |
push(String field,
Object value,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> cb) |
void |
pushAll(Enum field,
List value) |
void |
pushAll(Enum field,
List value,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> cb) |
void |
pushAll(String field,
List value) |
void |
pushAll(String field,
List value,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> cb) |
Query<T> |
q()
create a new empty query for the same type using the same mapper as this
|
Query<T> |
rawQuery(Map<String,Object> query) |
void |
set(Enum field,
Object value) |
void |
set(Enum field,
Object value,
AsyncOperationCallback<T> cb) |
void |
set(Enum field,
Object value,
boolean upsert,
boolean multiple) |
void |
set(Enum field,
Object value,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> cb) |
void |
set(Map<String,Object> map) |
void |
set(Map<String,Object> map,
AsyncOperationCallback<T> cb) |
void |
set(Map<String,Object> map,
boolean upsert,
boolean multiple) |
void |
set(Map<String,Object> map,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> cb) |
void |
set(String field,
Object value) |
void |
set(String field,
Object value,
AsyncOperationCallback<T> cb) |
void |
set(String field,
Object value,
boolean upsert,
boolean multiple) |
void |
set(String field,
Object value,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> cb) |
void |
setARHelper(AnnotationAndReflectionHelper ar) |
Query<T> |
setAutoValuesEnabled(boolean autoValues) |
Query<T> |
setCollation(Collation c) |
Query<T> |
setCollectionName(String n)
use a different collection name for the query
|
void |
setEnum(Map<Enum,Object> map) |
void |
setEnum(Map<Enum,Object> map,
AsyncOperationCallback<T> cb) |
void |
setEnum(Map<Enum,Object> map,
boolean upsert,
boolean multiple) |
void |
setEnum(Map<Enum,Object> map,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> cb) |
void |
setExecutor(ThreadPoolExecutor executor) |
void |
setMorphium(Morphium m) |
Query<T> |
setProjection(Enum... fl) |
Query<T> |
setProjection(String... fl) |
void |
setReadPreferenceLevel(ReadPreferenceLevel readPreferenceLevel) |
void |
setType(Class<? extends T> type)
what type to use
|
Query<T> |
skip(int i)
skip the first entries in result
|
Query<T> |
sort(Enum... naturalOrder) |
Query<T> |
sort(Map<String,Integer> n)
set an order - Key: FieldName (java or Mongo-Name), Value: Integer: -1 reverse, 1 standard
|
Query<T> |
sort(String... prefixedString)
set order by prefixing field names with - for reverse ordering (+ or nothing default)
|
Query<T> |
sortEnum(Map<Enum,Integer> n) |
void |
tail(int bufferSize,
int maxWait,
AsyncOperationCallback<T> cb) |
Query<T> |
text(Query.TextSearchLanguages lang,
boolean caseSensitive,
boolean diacriticSensitive,
String... text) |
Query<T> |
text(Query.TextSearchLanguages lang,
String... text) |
Query<T> |
text(String... text) |
Query<T> |
text(String metaScoreField,
Query.TextSearchLanguages lang,
boolean caseSensitive,
boolean diacriticSensitive,
String... text) |
Query<T> |
text(String metaScoreField,
Query.TextSearchLanguages lang,
String... text) |
List<T> |
textSearch(Query.TextSearchLanguages lang,
String... texts)
Deprecated.
|
List<T> |
textSearch(String... texts)
Deprecated.
|
Map<String,Object> |
toQueryObject()
create a db object from this query and all of it's child nodes
|
Query<T> |
where(String wh)
set the where string for this query - where-String needs to be valid java script!
|
Query<T> where(String wh)
wh - where stringMongoField<T> f(String f)
f - fieldString getServer()
void overrideDB(String db)
db - Collation getCollation()
String getDB()
MongoField<T> f(Enum field)
field - fieldQuery<T> limit(int i)
i - - limitQuery<T> sort(Map<String,Integer> n)
n - - sortQuery<T> sort(String... prefixedString)
prefixedString - sortlong countAll()
void countAll(AsyncOperationCallback<T> callback)
Query<T> addChild(FilterExpression e)
e - expressionMap<String,Object> toQueryObject()
Query<T> matchesJsonSchema(String schemaDef) throws org.json.simple.parser.ParseException
org.json.simple.parser.ParseExceptionvoid asList(AsyncOperationCallback<T> callback)
MorphiumQueryIterator<T> asIterable()
MorphiumQueryIterator<Map<String,Object>> asMapIterable()
MorphiumQueryIterator<T> asIterable(int windowSize, Class<? extends MorphiumQueryIterator<T>> it)
MorphiumQueryIterator<T> asIterable(MorphiumQueryIterator<T> ret)
MorphiumQueryIterator<T> asIterable(int windowSize)
MorphiumQueryIterator<T> asIterable(int windowSize, int prefixWindows)
windowSize - prefixWindows - void tail(int bufferSize,
int maxWait,
AsyncOperationCallback<T> cb)
T get()
void get(AsyncOperationCallback<T> callback)
<R> List<R> idList()
void idList(AsyncOperationCallback<T> callback)
Query<T> q()
@Deprecated List<T> complexQuery(Map<String,Object> query)
query - AnnotationAndReflectionHelper getARHelper()
void setARHelper(AnnotationAndReflectionHelper ar)
@Deprecated List<T> complexQuery(Map<String,Object> query, Map<String,Integer> sort, int skip, int limit)
query - - query to be sentskip - - amount to skiplimit - - maximium number of results@Deprecated List<T> complexQuery(Map<String,Object> query, String sort, int skip, int limit)
@Deprecated long complexQueryCount(Map<String,Object> query)
query - @Deprecated T complexQueryOne(Map<String,Object> query)
query - - query@Deprecated T complexQueryOne(Map<String,Object> query, Map<String,Integer> sort, int skip)
query - sort - skip - @Deprecated T complexQueryOne(Map<String,Object> query, Map<String,Integer> sort)
query - sort - int getLimit()
int getSkip()
Query<T> clone() throws CloneNotSupportedException
CloneNotSupportedExceptionReadPreferenceLevel getReadPreferenceLevel()
void setReadPreferenceLevel(ReadPreferenceLevel readPreferenceLevel)
String getWhere()
Morphium getMorphium()
void setMorphium(Morphium m)
void setExecutor(ThreadPoolExecutor executor)
@Deprecated void getById(Object id, AsyncOperationCallback<T> callback)
@Deprecated T getById(Object id)
id - void set(String field, Object value, boolean upsert, boolean multiple, AsyncOperationCallback<T> cb)
void set(Enum field, Object value, boolean upsert, boolean multiple, AsyncOperationCallback<T> cb)
void setEnum(Map<Enum,Object> map, boolean upsert, boolean multiple, AsyncOperationCallback<T> cb)
void set(Map<String,Object> map, boolean upsert, boolean multiple, AsyncOperationCallback<T> cb)
void set(String field, Object value, AsyncOperationCallback<T> cb)
void set(Enum field, Object value, AsyncOperationCallback<T> cb)
void setEnum(Map<Enum,Object> map, AsyncOperationCallback<T> cb)
void set(Map<String,Object> map, AsyncOperationCallback<T> cb)
void push(String field, Object value, boolean upsert, boolean multiple, AsyncOperationCallback<T> cb)
void push(Enum field, Object value, boolean upsert, boolean multiple, AsyncOperationCallback<T> cb)
void pushAll(String field, List value, boolean upsert, boolean multiple, AsyncOperationCallback<T> cb)
void pushAll(Enum field, List value, boolean upsert, boolean multiple, AsyncOperationCallback<T> cb)
void pullAll(String field, List value, boolean upsert, boolean multiple, AsyncOperationCallback<T> cb)
void pullAll(Enum field, List value, boolean upsert, boolean multiple, AsyncOperationCallback<T> cb)
void pull(String field, Object value, boolean upsert, boolean multiple, AsyncOperationCallback<T> cb)
void pull(Enum field, Object value, boolean upsert, boolean multiple, AsyncOperationCallback<T> cb)
void pull(Enum field, Expr value, boolean upsert, boolean multiple, AsyncOperationCallback<T> cb)
void inc(Enum field, Integer value, boolean upsert, boolean multiple, AsyncOperationCallback<T> cb)
void inc(String field, Integer value, boolean upsert, boolean multiple, AsyncOperationCallback<T> cb)
void inc(Enum field, Double value, boolean upsert, boolean multiple, AsyncOperationCallback<T> cb)
void inc(String field, Double value, boolean upsert, boolean multiple, AsyncOperationCallback<T> cb)
void inc(Enum field, Long value, boolean upsert, boolean multiple, AsyncOperationCallback<T> cb)
void inc(String field, Long value, boolean upsert, boolean multiple, AsyncOperationCallback<T> cb)
void inc(Enum field, Number value, boolean upsert, boolean multiple, AsyncOperationCallback<T> cb)
void inc(String field, Number value, boolean upsert, boolean multiple, AsyncOperationCallback<T> cb)
void dec(Enum field, Integer value, boolean upsert, boolean multiple, AsyncOperationCallback<T> cb)
void dec(String field, Integer value, boolean upsert, boolean multiple, AsyncOperationCallback<T> cb)
void dec(Enum field, Double value, boolean upsert, boolean multiple, AsyncOperationCallback<T> cb)
void dec(String field, Double value, boolean upsert, boolean multiple, AsyncOperationCallback<T> cb)
void dec(Enum field, Long value, boolean upsert, boolean multiple, AsyncOperationCallback<T> cb)
void dec(String field, Long value, boolean upsert, boolean multiple, AsyncOperationCallback<T> cb)
void dec(Enum field, Number value, boolean upsert, boolean multiple, AsyncOperationCallback<T> cb)
void dec(String field, Number value, boolean upsert, boolean multiple, AsyncOperationCallback<T> cb)
int getNumberOfPendingRequests()
String getCollectionName()
Query<T> setCollectionName(String n)
n - @Deprecated List<T> textSearch(String... texts)
@Deprecated List<T> textSearch(Query.TextSearchLanguages lang, String... texts)
MongoField<T> f(Enum... f)
MongoField<T> f(String... f)
void delete()
T findOneAndDelete()
boolean isAutoValuesEnabled()
String[] getTags()
Query<T> text(Query.TextSearchLanguages lang, String... text)
Query<T> text(Query.TextSearchLanguages lang, boolean caseSensitive, boolean diacriticSensitive, String... text)
Query<T> text(String metaScoreField, Query.TextSearchLanguages lang, boolean caseSensitive, boolean diacriticSensitive, String... text)
Query<T> text(String metaScoreField, Query.TextSearchLanguages lang, String... text)
Copyright © 2022. All rights reserved.