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 |
|---|---|
void |
addChild(FilterExpression e)
needed for creation of the query representation tree
|
void |
addReturnedField(Enum f) |
void |
addReturnedField(String f) |
MorphiumIterator<T> |
asIterable()
create an iterator / iterable for this query, default windowSize (10), prefetch windows 1
|
MorphiumIterator<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
|
MorphiumIterator<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...
|
List<T> |
asList()
the result as list
|
void |
asList(AsyncOperationCallback<T> callback) |
Query<T> |
clone() |
List<T> |
complexQuery(com.mongodb.DBObject query) |
List<T> |
complexQuery(com.mongodb.DBObject query,
Map<String,Integer> sort,
int skip,
int limit)
just sends the given query to the MongoDBDriver and masrhalls objects as listed
ignores all other query settings!!!!!
|
List<T> |
complexQuery(com.mongodb.DBObject query,
String sort,
int skip,
int limit) |
T |
complexQueryOne(com.mongodb.DBObject query)
same as copmplexQuery(query,0,1).get(0);
|
T |
complexQueryOne(com.mongodb.DBObject query,
Map<String,Integer> sort) |
T |
complexQueryOne(com.mongodb.DBObject query,
Map<String,Integer> sort,
int skip) |
long |
countAll()
count all results in query - does not take limit or skip into account
|
void |
countAll(AsyncOperationCallback<T> callback) |
void |
delete() |
void |
disableAutoValues() |
List |
distinct(String field) |
void |
enableAutoValues() |
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 |
get()
get only 1 result (first one in result list)
|
void |
get(AsyncOperationCallback<T> callback) |
T |
getById(Object id) |
void |
getById(Object id,
AsyncOperationCallback<T> callback) |
String |
getCollectionName() |
int |
getLimit() |
Morphium |
getMorphium() |
int |
getNumberOfPendingRequests() |
ReadPreferenceLevel |
getReadPreferenceLevel() |
com.mongodb.ServerAddress |
getServer()
returns the serveraddress the query was executed on
|
int |
getSkip() |
Map<String,Object> |
getSort() |
Class<? extends T> |
getType()
what type this query is for
|
String |
getWhere() |
<R> List<R> |
idList()
only return the IDs of objects (useful if objects are really large)
|
void |
idList(AsyncOperationCallback<T> callback) |
boolean |
isAutoValuesEnabled() |
Query<T> |
limit(int i)
limit the number of entries in result
|
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
|
Query<T> |
q()
create a new empty query for the same type using the same mapper as this
|
void |
setAutoValuesEnabled(boolean autoValues) |
void |
setCollectionName(String n)
use a different collection name for the query
|
void |
setExecutor(ThreadPoolExecutor executor) |
void |
setMorphium(Morphium m) |
void |
setReadPreferenceLevel(ReadPreferenceLevel readPreferenceLevel) |
void |
setReturnedFields(Enum... fl) |
void |
setReturnedFields(String... fl) |
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,Object> 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> |
text(Query.TextSearchLanguages lang,
String... text) |
Query<T> |
text(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.
|
com.mongodb.DBObject |
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 - fieldcom.mongodb.ServerAddress getServer()
MongoField<T> f(Enum field)
field - fieldQuery<T> limit(int i)
i - - limitQuery<T> sort(Map<String,Object> n)
n - - sortQuery<T> sort(String... prefixedString)
prefixedString - sortlong countAll()
void countAll(AsyncOperationCallback<T> callback)
void addChild(FilterExpression e)
e - expressioncom.mongodb.DBObject toQueryObject()
void asList(AsyncOperationCallback<T> callback)
MorphiumIterator<T> asIterable()
MorphiumIterator<T> asIterable(int windowSize)
MorphiumIterator<T> asIterable(int windowSize, int prefixWindows)
windowSize - prefixWindows - T get()
void get(AsyncOperationCallback<T> callback)
<R> List<R> idList()
void idList(AsyncOperationCallback<T> callback)
Query<T> q()
List<T> complexQuery(com.mongodb.DBObject query, Map<String,Integer> sort, int skip, int limit)
query - - query to be sentskip - - amount to skiplimit - - maximium number of resultsT complexQueryOne(com.mongodb.DBObject query)
query - - queryint 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)
void getById(Object id, AsyncOperationCallback<T> callback)
int getNumberOfPendingRequests()
void setCollectionName(String n)
n - String getCollectionName()
@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()
void setAutoValuesEnabled(boolean autoValues)
boolean isAutoValuesEnabled()
void disableAutoValues()
void enableAutoValues()
Query<T> text(Query.TextSearchLanguages lang, String... text)
Query<T> text(String metaScoreField, Query.TextSearchLanguages lang, String... text)
void setReturnedFields(String... fl)
void addReturnedField(String f)
void setReturnedFields(Enum... fl)
void addReturnedField(Enum f)
Copyright © 2014. All rights reserved.