play.modules.morphia
Class Model.MorphiaQuery
java.lang.Object
play.modules.morphia.Model.MorphiaQuery
- Enclosing class:
- Model
public static class Model.MorphiaQuery
- extends Object
|
Method Summary |
Model |
_get()
|
|
and(Criteria... criteria)
|
|
asKeyList()
|
|
asList()
|
Long |
average(String field)
|
|
batchSize(int value)
|
Model.MorphiaQuery |
clone()
|
Map<String,Long> |
cloud(String field)
|
DBCollection |
col()
|
long |
count()
Alias of countAll() |
long |
countAll()
|
|
criteria(String field)
|
long |
delete()
|
|
disableCursorTimeout()
|
|
disableSnapshotMode()
|
|
disableTimeout()
Deprecated. |
|
disableValidation()
|
Set<?> |
distinct(String key)
|
static Datastore |
ds()
|
|
enableCursorTimeout()
|
|
enableSnapshotMode()
|
|
enableTimeout()
Deprecated. |
|
enableValidation()
|
|
fetch()
|
|
fetch(int max)
Retrieve results of the query |
|
fetch(int page,
int length)
Retrieve a page of result |
|
fetchAll()
Retrieve all results of the query
This is a correspondence to JPAQuery's fetch(), which however, used
as another method signature of Morphia Query |
|
fetchEmptyEntities()
|
|
fetchKeys()
|
|
field(String field)
|
|
filter(String condition,
Object value)
|
Model.MorphiaQuery |
findBy(String query,
Object... params)
Used to simulate JPA.find("byXXAndYY", ...); |
|
first()
|
|
from(int position)
Set the position to start |
|
get()
|
Class<? extends Model> |
getEntityClass()
|
|
getKey()
|
Query<? extends Model> |
getMorphiaQuery()
|
DBObject |
getQueryObject()
|
List<CommandResult> |
group(String groupKeys,
DBObject initial,
String reduce,
String finalize)
|
AggregationResult |
groupAverage(String field,
String... groupKeys)
|
AggregationResult |
groupCount(String field,
String... groupKeys)
|
AggregationResult |
groupMax(String field,
String... groupKeys)
|
AggregationResult |
groupMin(String field,
String... groupKeys)
|
AggregationResult |
groupSum(String field,
String... groupKeys)
|
|
hintIndex(String idxName)
|
|
iterator()
|
|
limit(int value)
|
Long |
max(String maxField)
|
Long |
min(String minField)
|
|
offset(int value)
|
|
or(Criteria... criteria)
|
|
order(String condition)
|
|
queryNonPrimary()
|
|
queryPrimaryOnly()
|
|
retrievedFields(boolean include,
String... fields)
|
|
skip(int value)
Deprecated. |
Long |
sum(String field)
|
String |
toString()
|
|
where(CodeWScope js)
|
|
where(String js)
|
Model.MorphiaQuery
public Model.MorphiaQuery(Class<? extends Model> clazz)
Model.MorphiaQuery
public Model.MorphiaQuery(Class<? extends Model> clazz,
DBCollection coll,
Datastore ds)
Model.MorphiaQuery
public Model.MorphiaQuery(Class<? extends Model> clazz,
DBCollection coll,
Datastore ds,
int offset,
int limit)
ds
public static Datastore ds()
getMorphiaQuery
public Query<? extends Model> getMorphiaQuery()
getQueryObject
public DBObject getQueryObject()
col
public DBCollection col()
delete
public long delete()
count
public long count()
- Alias of countAll()
- Returns:
findBy
public Model.MorphiaQuery findBy(String query,
Object... params)
- Used to simulate JPA.find("byXXAndYY", ...);
- Parameters:
query - could be either "Key1[AndKey2[AndKey3]]" or
"byKey1[AndKey2[AndKey3]]" or "key1 key2 ..."params - the number of params should either be exactly one or the
number match the key number
- Returns:
toString
public String toString()
- Overrides:
toString in class Object
first
public <T> T first()
from
public <T> Model.MorphiaQuery from(int position)
- Set the position to start
- Parameters:
position - Position of the first element
- Returns:
- A new query
fetchAll
public <T extends Model> List<T> fetchAll()
- Retrieve all results of the query
This is a correspondence to JPAQuery's fetch(), which however, used
as another method signature of Morphia Query
- Returns:
- A list of entities
fetch
public <T extends Model> List<T> fetch(int max)
- Retrieve results of the query
- Parameters:
max - Max results to fetch
- Returns:
- A list of entities
fetch
public <T extends Model> List<T> fetch(int page,
int length)
- Retrieve a page of result
- Parameters:
page - Page number (start at 1)length - (page length)
- Returns:
- a list of entities
_get
public Model _get()
get
public <T extends Model> T get()
filter
public <T extends Model> Model.MorphiaQuery filter(String condition,
Object value)
getKey
public <T extends Model> Key<T> getKey()
iterator
public <T extends Model> Iterator<T> iterator()
asList
public <T extends Model> List<T> asList()
asKeyList
public <T extends Model> List<Key<T>> asKeyList()
fetch
public <T extends Model> Iterable<T> fetch()
distinct
public Set<?> distinct(String key)
cloud
public Map<String,Long> cloud(String field)
group
public List<CommandResult> group(String groupKeys,
DBObject initial,
String reduce,
String finalize)
- Parameters:
groupKeys - could be either "f1Andf2.." or "f1 f2" or "f1,f2"
- Returns:
groupMax
public AggregationResult groupMax(String field,
String... groupKeys)
max
public Long max(String maxField)
groupMin
public AggregationResult groupMin(String field,
String... groupKeys)
min
public Long min(String minField)
groupAverage
public AggregationResult groupAverage(String field,
String... groupKeys)
average
public Long average(String field)
groupSum
public AggregationResult groupSum(String field,
String... groupKeys)
sum
public Long sum(String field)
groupCount
public AggregationResult groupCount(String field,
String... groupKeys)
fetchEmptyEntities
public <T extends Model> Iterable<T> fetchEmptyEntities()
field
public <T extends Model> FieldEnd<? extends Query<T>> field(String field)
fetchKeys
public <T extends Model> Iterable<Key<T>> fetchKeys()
criteria
public <T extends Model> FieldEnd<? extends CriteriaContainerImpl> criteria(String field)
and
public <T extends Model> CriteriaContainer and(Criteria... criteria)
countAll
public long countAll()
or
public <T extends Model> CriteriaContainer or(Criteria... criteria)
where
public <T extends Model> Model.MorphiaQuery where(String js)
where
public <T extends Model> Model.MorphiaQuery where(CodeWScope js)
order
public <T extends Model> Model.MorphiaQuery order(String condition)
limit
public <T extends Model> Model.MorphiaQuery limit(int value)
batchSize
public <T extends Model> Model.MorphiaQuery batchSize(int value)
offset
public <T extends Model> Model.MorphiaQuery offset(int value)
skip
@Deprecated
public <T extends Model> Model.MorphiaQuery skip(int value)
- Deprecated.
enableValidation
public <T extends Model> Model.MorphiaQuery enableValidation()
disableValidation
public <T extends Model> Model.MorphiaQuery disableValidation()
hintIndex
public <T extends Model> Model.MorphiaQuery hintIndex(String idxName)
retrievedFields
public <T extends Model> Model.MorphiaQuery retrievedFields(boolean include,
String... fields)
enableSnapshotMode
public <T extends Model> Model.MorphiaQuery enableSnapshotMode()
disableSnapshotMode
public <T extends Model> Model.MorphiaQuery disableSnapshotMode()
queryNonPrimary
public <T extends Model> Model.MorphiaQuery queryNonPrimary()
queryPrimaryOnly
public <T extends Model> Model.MorphiaQuery queryPrimaryOnly()
disableTimeout
@Deprecated
public <T extends Model> Model.MorphiaQuery disableTimeout()
- Deprecated.
disableCursorTimeout
public <T extends Model> Model.MorphiaQuery disableCursorTimeout()
enableTimeout
@Deprecated
public <T extends Model> Model.MorphiaQuery enableTimeout()
- Deprecated.
enableCursorTimeout
public <T extends Model> Model.MorphiaQuery enableCursorTimeout()
getEntityClass
public Class<? extends Model> getEntityClass()
clone
public Model.MorphiaQuery clone()
- Overrides:
clone in class Object
Copyright © 2012. All Rights Reserved.