|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
T
- The java type to query againstpublic interface Query<T>
Method Summary | |
---|---|
CriteriaContainer |
and(Criteria... criteria)
|
Query<T> |
batchSize(int value)
Batch-size of the fetched result (cursor). |
Query<T> |
cloneQuery()
Creates and returns a copy of this Query . |
Query<T> |
comment(String comment)
This makes it possible to attach a comment to a query. |
FieldEnd<? extends CriteriaContainerImpl> |
criteria(String field)
Criteria builder interface |
Query<T> |
disableCursorTimeout()
Disables cursor timeout on server. |
Query<T> |
disableSnapshotMode()
Disable snapshotted mode (default mode). |
Query<T> |
disableValidation()
Turns off validation (for all calls made after) |
Query<T> |
enableCursorTimeout()
Enables cursor timeout on server. |
Query<T> |
enableSnapshotMode()
Enabled snapshotted mode where duplicate results (which may be updated during the lifetime of the cursor) will not be returned. |
Query<T> |
enableValidation()
Turns on validation (for all calls made after); by default validation is on |
Map<String,Object> |
explain()
Provides information on the query plan. |
FieldEnd<? extends Query<T>> |
field(String field)
Fluent query interface: createQuery(Ent.class).field("count").greaterThan(7)... |
Query<T> |
filter(String condition,
Object value)
Create a filter based on the specified condition and value. |
int |
getBatchSize()
Returns the batch size |
DBCollection |
getCollection()
Returns the DBCollection of the Query . |
Class<T> |
getEntityClass()
Returns the entity Class . |
DBObject |
getFieldsObject()
Returns the Mongo fields DBObject . |
int |
getLimit()
Returns the limit |
int |
getOffset()
Returns the offset. |
DBObject |
getQueryObject()
Returns the Mongo query DBObject . |
DBObject |
getSortObject()
Returns the Mongo sort DBObject . |
Query<T> |
hintIndex(String idxName)
Hints as to which index should be used. |
Query<T> |
limit(int value)
Limit the fetched result set to a certain number of values. |
Query<T> |
lowerIndexBound(DBObject lowerBound)
Specify the inclusive lower bound for a specific index in order to constrain the results of this query. |
Query<T> |
maxScan(int value)
Constrains the query to only scan the specified number of documents when fulfilling the query. |
Query<T> |
maxTime(long maxTime,
TimeUnit maxTimeUnit)
Specifies a time limit for executing the query. |
Query<T> |
offset(int value)
Starts the query results at a particular zero-based offset. |
CriteriaContainer |
or(Criteria... criteria)
|
Query<T> |
order(String condition)
Sorts based on a property (defines return order). |
Query<T> |
queryNonPrimary()
Route query to non-primary node |
Query<T> |
queryPrimaryOnly()
Route query to primary node |
Query<T> |
retrievedFields(boolean include,
String... fields)
Limits the fields retrieved |
Query<T> |
retrieveKnownFields()
Limits the fields retrieved to those of the query type -- dangerous with interfaces and abstract classes |
Query<T> |
returnKey()
Only return the index field or fields for the results of the query. |
Query<T> |
search(String text)
Perform a text search on the content of the fields indexed with a text index.. |
Query<T> |
search(String text,
String language)
Perform a text search on the content of the fields indexed with a text index.. |
String |
toString()
Generates a string that consistently and uniquely specifies this query. |
Query<T> |
upperIndexBound(DBObject upperBound)
Specify the exclusive upper bound for a specific index in order to constrain the results of this query. |
Query<T> |
useReadPreference(ReadPreference readPref)
Route query ReadPreference |
Query<T> |
where(CodeWScope js)
Limit the query using this javascript block; only one per query |
Query<T> |
where(String js)
Limit the query using this javascript block; only one per query |
Methods inherited from interface org.mongodb.morphia.query.QueryResults |
---|
asKeyList, asList, countAll, fetch, fetchEmptyEntities, fetchKeys, get, getKey, tail, tail |
Methods inherited from interface java.lang.Iterable |
---|
iterator |
Method Detail |
---|
Query<T> filter(String condition, Object value)
Create a filter based on the specified condition and value.
Note: Property is in the form of "name op" ("age >").
Valid operators are ["=", "==","!=", "<>", ">", "<", ">=", "<=", "in", "nin", "all", "size", "exists"]
Examples:
filter("yearsOfOperation >", 5)
filter("rooms.maxBeds >=", 2)
filter("rooms.bathrooms exists", 1)
filter("stars in", new Long[]{3, 4}) //3 and 4 stars (midrange?)
filter("quantity mod", new Long[]{4, 0}) // customers ordered in packs of 4)
filter("age >=", age)
filter("age =", age)
filter("age", age)
(if no operator, = is assumed)filter("age !=",
age)
filter("age in", ageList)
filter("customers.loyaltyYears in", yearsList)
You can filter on id properties if this query is restricted to a Class
FieldEnd<? extends Query<T>> field(String field)
createQuery(Ent.class).field("count").greaterThan(7)...
FieldEnd<? extends CriteriaContainerImpl> criteria(String field)
CriteriaContainer and(Criteria... criteria)
CriteriaContainer or(Criteria... criteria)
Query<T> where(String js)
Query<T> where(CodeWScope js)
Query<T> order(String condition)
Sorts based on a property (defines return order). Examples:
order("age")
order("-age")
(descending order)order("age, date")
order("age,-date")
(age ascending, date descending)
Query<T> limit(int value)
value
- must be >= 0. A value of 0 indicates no limit. For values < 0, use batchSize(int)
which is the preferred
methodQuery<T> batchSize(int value)
value
- must be >= 0. A value of 0 indicates the server default.Query<T> maxScan(int value)
value
- must be > 0. A value < 0 indicates no limitQuery<T> maxTime(long maxTime, TimeUnit maxTimeUnit)
maxTime
- must be > 0. A value < 0 indicates no limitmaxTimeUnit
- Query<T> comment(String comment)
comment
- the comment to add
Query<T> returnKey()
Query<T> search(String text)
text
- the text to search for
Query<T> search(String text, String language)
text
- the text to search forlanguage
- the language to use during the search
Query<T> offset(int value)
value
- must be >= 0Query<T> upperIndexBound(DBObject upperBound)
Specify the exclusive upper bound for a specific index in order to constrain the results of this query.
You can chain key/value pairs to build a constraint for a compound index. For instance: query.upperIndexBound(new
BasicDBObject("a", 1).append("b", 2));
to build a constraint on index {"a", "b"}
upperBound
- The exclusive upper bound.Query<T> lowerIndexBound(DBObject lowerBound)
Specify the inclusive lower bound for a specific index in order to constrain the results of this query.
You can chain key/value pairs to build a constraint for a compound index. For instance: query.lowerIndexBound(new
BasicDBObject("a", 1).append("b", 2));
to build a constraint on index {"a", "b"}
lowerBound
- The inclusive lower bound.Query<T> enableValidation()
Query<T> disableValidation()
Query<T> hintIndex(String idxName)
Query<T> retrievedFields(boolean include, String... fields)
Query<T> retrieveKnownFields()
Query<T> enableSnapshotMode()
Query<T> disableSnapshotMode()
Query<T> queryNonPrimary()
Query<T> queryPrimaryOnly()
Query<T> useReadPreference(ReadPreference readPref)
Query<T> disableCursorTimeout()
Query<T> enableCursorTimeout()
String toString()
Generates a string that consistently and uniquely specifies this query. There is no way to convert this string back into a query and there is no guarantee that the string will be consistent across versions.
In particular, this value is useful as a key for a simple memcache query cache.
toString
in class Object
Class<T> getEntityClass()
Class
.
int getOffset()
offset(int)
int getLimit()
limit(int)
int getBatchSize()
batchSize(int)
DBObject getQueryObject()
DBObject
.
DBObject getSortObject()
DBObject
.
DBObject getFieldsObject()
DBObject
.
DBCollection getCollection()
DBCollection
of the Query
.
Map<String,Object> explain()
Query<T> cloneQuery()
Query
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |