Package dev.morphia.query
Interface Query<T>
-
- Type Parameters:
T
- The java type to query against
- All Superinterfaces:
java.lang.Iterable<T>
,com.mongodb.client.MongoIterable<T>
,QueryResults<T>
- All Known Implementing Classes:
QueryImpl
public interface Query<T> extends QueryResults<T>, com.mongodb.client.MongoIterable<T>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description CriteriaContainer
and(Criteria... criteria)
Creates a container to hold 'and' clausesjava.util.List<Key<T>>
asKeyList()
Deprecated.usekeys()
java.util.List<Key<T>>
asKeyList(FindOptions options)
Deprecated.java.util.List<T>
asList()
Deprecated.java.util.List<T>
asList(FindOptions options)
Deprecated.Query<T>
batchSize(int value)
Deprecated.use the methods that accept Options directlyQuery<T>
cloneQuery()
Deprecated.not supported in 2.0Query<T>
comment(java.lang.String comment)
Deprecated.use the methods that accept Options directly.long
count()
Count the total number of values in the result, ignoring limit and offsetlong
count(CountOptions options)
Count the total number of values in the result, ignoring limit and offsetlong
countAll()
Deprecated.usecount()
insteadFieldEnd<? extends CriteriaContainer>
criteria(java.lang.String field)
Creates a criteria to apply against a fieldQuery<T>
disableCursorTimeout()
Deprecated.use the methods that accept Options directlyQuery<T>
disableValidation()
Turns off validation (for all calls made after)Query<T>
enableCursorTimeout()
Deprecated.use the methods that accept Options directlyQuery<T>
enableValidation()
Turns on validation (for all calls made after); by default validation is onjava.util.Map<java.lang.String,java.lang.Object>
explain()
Provides information on the query plan.java.util.Map<java.lang.String,java.lang.Object>
explain(FindOptions options)
Provides information on the query plan.MorphiaIterator<T,T>
fetch()
Deprecated.usefind(FindOptions)
insteadMorphiaIterator<T,T>
fetch(FindOptions options)
Deprecated.usefind(FindOptions)
insteadMorphiaIterator<T,T>
fetchEmptyEntities()
Deprecated.usekeys()
insteadMorphiaIterator<T,T>
fetchEmptyEntities(FindOptions options)
Deprecated.usekeys(FindOptions)
insteadMorphiaKeyIterator<T>
fetchKeys()
Deprecated.usekeys()
MorphiaKeyIterator<T>
fetchKeys(FindOptions options)
Deprecated.FieldEnd<? extends Query<T>>
field(java.lang.String field)
Fluent query interface:createQuery(Ent.class).field("count").greaterThan(7)...
Query<T>
filter(java.lang.String condition, java.lang.Object value)
Create a filter based on the specified condition and value.MorphiaCursor<T>
find()
Execute the query and get the results.MorphiaCursor<T>
find(FindOptions options)
Execute the query and get the results.T
first(FindOptions options)
Gets the first entity in the result set.T
get()
Deprecated.useMongoIterable.first()
T
get(FindOptions options)
Deprecated.int
getBatchSize()
Deprecated.use the methods that accept Options directlycom.mongodb.DBCollection
getCollection()
Deprecated.This is an internal method and subject to change or removal.java.lang.Class<T>
getEntityClass()
Deprecated.com.mongodb.DBObject
getFieldsObject()
Deprecated.Key<T>
getKey()
Deprecated.useMongoIterable.first()
insteadKey<T>
getKey(FindOptions options)
Deprecated.useMongoIterable.first()
insteadint
getLimit()
Deprecated.use the methods that accept Options directlyint
getOffset()
Deprecated.use the methods that accept Options directlycom.mongodb.DBObject
getQueryObject()
Deprecated.com.mongodb.DBObject
getSortObject()
Deprecated.Query<T>
hintIndex(java.lang.String idxName)
Deprecated.use the methods that accept Options directly.MorphiaKeyCursor<T>
keys()
Execute the query and get the results (as aMorphiaCursor<Key<T>>
)MorphiaKeyCursor<T>
keys(FindOptions options)
Execute the query and get the results (as aMorphiaCursor<Key<T>>
)Query<T>
limit(int value)
Deprecated.use the methods that accept Options directlyQuery<T>
lowerIndexBound(com.mongodb.DBObject lowerBound)
Deprecated.use the methods that accept Options directly.Query<T>
maxScan(int value)
Deprecated.no replacement is plannedQuery<T>
maxTime(long maxTime, java.util.concurrent.TimeUnit maxTimeUnit)
Deprecated.useFindOptions.maxTime(long, TimeUnit)
insteadQuery<T>
offset(int value)
Deprecated.use the methods that accept Options directlyCriteriaContainer
or(Criteria... criteria)
Creates a container to hold 'or' clausesQuery<T>
order(Meta sort)
Deprecated.Query<T>
order(Sort... sorts)
Deprecated.Query<T>
order(java.lang.String sort)
Deprecated.useorder(Sort...)
Query<T>
project(Meta meta)
Deprecated.Query<T>
project(java.lang.String field, boolean include)
Deprecated.Query<T>
project(java.lang.String field, ArraySlice slice)
Deprecated.Query<T>
queryNonPrimary()
Deprecated.use the methods that accept Options directlyQuery<T>
queryPrimaryOnly()
Deprecated.use the methods that accept Options directly.Query<T>
retrievedFields(boolean include, java.lang.String... fields)
Deprecated.useproject(String, boolean)
insteadQuery<T>
retrieveKnownFields()
Limits the fields retrieved to those of the query type -- dangerous with interfaces and abstract classesQuery<T>
returnKey()
Deprecated.use the methods that accept Options directly.Query<T>
search(java.lang.String text)
Perform a text search on the content of the fields indexed with a text index..Query<T>
search(java.lang.String text, java.lang.String language)
Perform a text search on the content of the fields indexed with a text index..MorphiaIterator<T,T>
tail()
Deprecated.set the CursorType onFindOptions
and usefind(FindOptions)
insteadMorphiaIterator<T,T>
tail(boolean awaitData)
Deprecated.set the CursorType onFindOptions
and usefind(FindOptions)
instead.Query<T>
upperIndexBound(com.mongodb.DBObject upperBound)
Deprecated.use the methods that accept Options directly.Query<T>
useReadPreference(com.mongodb.ReadPreference readPref)
Deprecated.use the methods that accept Options directlyQuery<T>
where(java.lang.String js)
Deprecated.no replacement is plannedQuery<T>
where(org.bson.types.CodeWScope js)
Deprecated.no replacement is planned
-
-
-
Method Detail
-
and
CriteriaContainer and(Criteria... criteria)
Creates a container to hold 'and' clauses- Parameters:
criteria
- the clauses to 'and' together- Returns:
- the container
-
batchSize
@Deprecated Query<T> batchSize(int value)
Deprecated.use the methods that accept Options directlyBatch-size of the fetched result (cursor).- Specified by:
batchSize
in interfacecom.mongodb.client.MongoIterable<T>
- Parameters:
value
- must be >= 0. A value of 0 indicates the server default.- Returns:
- this
- See Also:
FindOptions.batchSize(int)
-
cloneQuery
@Deprecated Query<T> cloneQuery()
Deprecated.not supported in 2.0Creates and returns a copy of thisQuery
.- Returns:
- this
Developer note. This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
comment
@Deprecated Query<T> comment(java.lang.String comment)
Deprecated.use the methods that accept Options directly. This can be replicated withFindOptions.comment(String)
This makes it possible to attach a comment to a query. Because these comments propagate to the profile log, adding comments can make your profile data much easier to interpret and trace.- Parameters:
comment
- the comment to add- Returns:
- the Query to enable chaining of commands
- MongoDB documentation
- reference/operator/meta/comment $comment
-
criteria
FieldEnd<? extends CriteriaContainer> criteria(java.lang.String field)
Creates a criteria to apply against a field- Parameters:
field
- the field- Returns:
- the FieldEnd to define the criteria
-
disableCursorTimeout
@Deprecated Query<T> disableCursorTimeout()
Deprecated.use the methods that accept Options directlyDisables cursor timeout on server.- Returns:
- this
- See Also:
FindOptions.noCursorTimeout(boolean)
-
disableValidation
Query<T> disableValidation()
Turns off validation (for all calls made after)- Returns:
- this
-
enableCursorTimeout
@Deprecated Query<T> enableCursorTimeout()
Deprecated.use the methods that accept Options directlyEnables cursor timeout on server.- Returns:
- this
- See Also:
FindOptions.noCursorTimeout(boolean)
-
enableValidation
Query<T> enableValidation()
Turns on validation (for all calls made after); by default validation is on- Returns:
- this
-
explain
java.util.Map<java.lang.String,java.lang.Object> explain()
Provides information on the query plan. The query plan is the plan the server uses to find the matches for a query. This information may be useful when optimizing a query.- Returns:
- Map describing the process used to return the query results.
- MongoDB documentation
- reference/operator/meta/explain/ explain
-
explain
java.util.Map<java.lang.String,java.lang.Object> explain(FindOptions options)
Provides information on the query plan. The query plan is the plan the server uses to find the matches for a query. This information may be useful when optimizing a query.- Parameters:
options
- the options to apply to the explain operation- Returns:
- Map describing the process used to return the query results.
- Since:
- 1.3
- MongoDB documentation
- reference/operator/meta/explain/ explain
-
field
FieldEnd<? extends Query<T>> field(java.lang.String field)
Fluent query interface:createQuery(Ent.class).field("count").greaterThan(7)...
- Parameters:
field
- the field- Returns:
- the FieldEnd to define the criteria
-
filter
Query<T> filter(java.lang.String condition, java.lang.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
. - Parameters:
condition
- the condition to applyvalue
- the value to apply against- Returns:
- this
-
getBatchSize
@Deprecated int getBatchSize()
Deprecated.use the methods that accept Options directly- Returns:
- the batch size
- See Also:
batchSize(int)
,FindOptions.batchSize(int)
-
getCollection
@Deprecated com.mongodb.DBCollection getCollection()
Deprecated.This is an internal method and subject to change or removal. Do not use.- Returns:
- the collection this query targets
Developer note. This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
getEntityClass
@Deprecated java.lang.Class<T> getEntityClass()
Deprecated.- Returns:
- the entity
Class
.
Developer note. This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
getFieldsObject
@Deprecated com.mongodb.DBObject getFieldsObject()
Deprecated.- Returns:
- the Mongo fields
DBObject
.
Developer note. This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
getLimit
@Deprecated int getLimit()
Deprecated.use the methods that accept Options directly- Returns:
- the limit
- See Also:
limit(int)
,FindOptions.limit(int)
-
getOffset
@Deprecated int getOffset()
Deprecated.use the methods that accept Options directly- Returns:
- the offset.
- See Also:
offset(int)
,FindOptions.getSkip()
-
getQueryObject
@Deprecated com.mongodb.DBObject getQueryObject()
Deprecated.- Returns:
- the Mongo query
DBObject
.
Developer note. This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
getSortObject
@Deprecated com.mongodb.DBObject getSortObject()
Deprecated.- Returns:
- the Mongo sort
DBObject
.
Developer note. This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
hintIndex
@Deprecated Query<T> hintIndex(java.lang.String idxName)
Deprecated.use the methods that accept Options directly. This can be replicated withoptions.modifier("$hint", idxName)
Hints as to which index should be used.- Parameters:
idxName
- the index name to hint- Returns:
- this
- See Also:
FindOptions.hint(DBObject)
-
limit
@Deprecated Query<T> limit(int value)
Deprecated.use the methods that accept Options directlyLimit the fetched result set to a certain number of values.- Parameters:
value
- must be >= 0. A value of 0 indicates no limit. For values < 0, useFindOptions.batchSize(int)
which is the preferred method- Returns:
- this
- See Also:
FindOptions.limit(int)
-
lowerIndexBound
@Deprecated Query<T> lowerIndexBound(com.mongodb.DBObject lowerBound)
Deprecated.use the methods that accept Options directly.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"}
- Parameters:
lowerBound
- The inclusive lower bound.- Returns:
- this
- See Also:
FindOptions.min(DBObject)
- MongoDB documentation
- reference/operator/meta/min/ $min
-
maxScan
@Deprecated Query<T> maxScan(int value)
Deprecated.no replacement is plannedConstrains the query to only scan the specified number of documents when fulfilling the query.- Parameters:
value
- must be > 0. A value < 0 indicates no limit- Returns:
- this
- MongoDB documentation
- reference/operator/meta/maxScan/#op._S_maxScan $maxScan
-
maxTime
@Deprecated Query<T> maxTime(long maxTime, java.util.concurrent.TimeUnit maxTimeUnit)
Deprecated.useFindOptions.maxTime(long, TimeUnit)
insteadSpecifies a time limit for executing the query. Requires server version 2.6 or above.- Parameters:
maxTime
- must be > 0. A value < 0 indicates no limitmaxTimeUnit
- the unit of time to use- Returns:
- this
- See Also:
FindOptions.maxTime(long, TimeUnit)
-
offset
@Deprecated Query<T> offset(int value)
Deprecated.use the methods that accept Options directlyStarts the query results at a particular zero-based offset.- Parameters:
value
- must be >= 0- Returns:
- this
- See Also:
FindOptions.skip(int)
-
or
CriteriaContainer or(Criteria... criteria)
Creates a container to hold 'or' clauses- Parameters:
criteria
- the clauses to 'or' together- Returns:
- the container
-
order
@Deprecated Query<T> order(java.lang.String sort)
Deprecated.useorder(Sort...)
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)
- Parameters:
sort
- the sort order to apply- Returns:
- this
-
order
@Deprecated Query<T> order(Meta sort)
Deprecated.Sorts based on a metadata (defines return order). Example:order(Meta.textScore())
({textScore : { $meta: "textScore" }})- Parameters:
sort
- the sort order to apply- Returns:
- this
-
order
@Deprecated Query<T> order(Sort... sorts)
Deprecated.Sorts based on a specified sort keys (defines return order).- Parameters:
sorts
- the sort order to apply- Returns:
- this
-
project
@Deprecated Query<T> project(java.lang.String field, boolean include)
Deprecated.Adds a field to the projection clause. Passing true for include will include the field in the results. Projected fields must all be inclusions or exclusions. You can not include and exclude fields at the same time with the exception of the _id field. The _id field is always included unless explicitly suppressed.- Parameters:
field
- the field to projectinclude
- true to include the field in the results- Returns:
- this
- See Also:
- Project Fields to Return from Query
-
project
@Deprecated Query<T> project(java.lang.String field, ArraySlice slice)
Deprecated.Adds an sliced array field to a projection.- Parameters:
field
- the field to projectslice
- the options for projecting an array field- Returns:
- this
- See Also:
- Project Fields to Return from Query
- MongoDB documentation
- /reference/operator/projection/slice/ $slice
-
project
@Deprecated Query<T> project(Meta meta)
Deprecated.Adds a metadata field to a projection.- Parameters:
meta
- the metadata option for projecting- Returns:
- this
- See Also:
- Project Fields to Return from Query
- MongoDB documentation
- reference/operator/projection/meta/ $meta
-
queryNonPrimary
@Deprecated Query<T> queryNonPrimary()
Deprecated.use the methods that accept Options directlyRoute query to non-primary node- Returns:
- this
- See Also:
ReadPreference.secondary()
,ReadPreference.secondaryPreferred()
,FindOptions.readPreference(ReadPreference)
,ReadPreference.secondary()
,ReadPreference.secondaryPreferred()
-
queryPrimaryOnly
@Deprecated Query<T> queryPrimaryOnly()
Deprecated.use the methods that accept Options directly.Route query to primary node- Returns:
- this
- See Also:
ReadPreference.primary()
,FindOptions.readPreference(ReadPreference)
,ReadPreference.primary()
,ReadPreference.primaryPreferred()
-
retrieveKnownFields
Query<T> retrieveKnownFields()
Limits the fields retrieved to those of the query type -- dangerous with interfaces and abstract classes- Returns:
- this
-
retrievedFields
@Deprecated Query<T> retrievedFields(boolean include, java.lang.String... fields)
Deprecated.useproject(String, boolean)
insteadLimits the fields retrieved- Parameters:
include
- true if the fields should be included in the results. false to exclude them.fields
- the fields in question- Returns:
- this
-
returnKey
@Deprecated Query<T> returnKey()
Deprecated.use the methods that accept Options directly.Only return the index field or fields for the results of the query. If $returnKey is set to true and the query does not use an index to perform the read operation, the returned documents will not contain any fields- Returns:
- the Query to enable chaining of commands
- See Also:
FindOptions.returnKey(boolean)
- MongoDB documentation
- reference/operator/meta/returnKey/#op._S_returnKey $returnKey
-
search
Query<T> search(java.lang.String text)
Perform a text search on the content of the fields indexed with a text index..- Parameters:
text
- the text to search for- Returns:
- the Query to enable chaining of commands
- MongoDB documentation
- reference/operator/query/text/ $text
-
search
Query<T> search(java.lang.String text, java.lang.String language)
Perform a text search on the content of the fields indexed with a text index..- Parameters:
text
- the text to search forlanguage
- the language to use during the search- Returns:
- the Query to enable chaining of commands
- MongoDB documentation
- reference/operator/query/text/ $text
-
upperIndexBound
@Deprecated Query<T> upperIndexBound(com.mongodb.DBObject upperBound)
Deprecated.use the methods that accept Options directly.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"}
- Parameters:
upperBound
- The exclusive upper bound.- Returns:
- this
- See Also:
FindOptions.max(DBObject)
- MongoDB documentation
- reference/operator/meta/max/ $max
-
useReadPreference
@Deprecated Query<T> useReadPreference(com.mongodb.ReadPreference readPref)
Deprecated.use the methods that accept Options directlyUpdates the ReadPreference to use- Parameters:
readPref
- the ReadPreference to use- Returns:
- this
- See Also:
ReadPreference
,FindOptions.readPreference(ReadPreference)
-
where
@Deprecated Query<T> where(java.lang.String js)
Deprecated.no replacement is plannedLimit the query using this javascript block; only one per query- Parameters:
js
- the javascript block to apply- Returns:
- this
-
where
@Deprecated Query<T> where(org.bson.types.CodeWScope js)
Deprecated.no replacement is plannedLimit the query using this javascript block; only one per query- Parameters:
js
- the javascript block to apply- Returns:
- this
-
asKeyList
@Deprecated java.util.List<Key<T>> asKeyList()
Deprecated.usekeys()
Execute the query and get the results (as aList<Key<T>>
) This method is provided as a convenience;- Returns:
- returns a List of the keys of the documents returned by a query
-
asKeyList
@Deprecated java.util.List<Key<T>> asKeyList(FindOptions options)
Deprecated.Execute the query and get the results (as aList<Key<T>>
) This method is provided as a convenience;- Parameters:
options
- the options to apply to the find operation- Returns:
- returns a List of the keys of the documents returned by a query
- Since:
- 1.3
-
keys
MorphiaKeyCursor<T> keys()
Execute the query and get the results (as aMorphiaCursor<Key<T>>
)- Returns:
- the keys of the documents returned by this query
-
keys
MorphiaKeyCursor<T> keys(FindOptions options)
Execute the query and get the results (as aMorphiaCursor<Key<T>>
)- Parameters:
options
- the options to apply to the find operation- Returns:
- the keys of the documents returned by this query
- Since:
- 1.4
-
asList
@Deprecated java.util.List<T> asList()
Deprecated.Execute the query and get the results.- Returns:
- returns a List of the documents returned by a query
-
asList
@Deprecated java.util.List<T> asList(FindOptions options)
Deprecated.Execute the query and get the results.- Parameters:
options
- the options to apply to the find operation- Returns:
- returns a List of the documents returned by a query
- Since:
- 1.3
-
countAll
@Deprecated long countAll()
Deprecated.usecount()
insteadCount the total number of values in the result, ignoring limit and offset- Returns:
- the count
-
count
long count()
Count the total number of values in the result, ignoring limit and offset- Returns:
- the count
- Since:
- 1.3
-
count
long count(CountOptions options)
Count the total number of values in the result, ignoring limit and offset- Parameters:
options
- the options to apply to the count operation- Returns:
- the count
- Since:
- 1.3
-
fetch
@Deprecated MorphiaIterator<T,T> fetch()
Deprecated.usefind(FindOptions)
insteadExecute the query and get the results.- Returns:
- an Iterator of the results
-
fetch
@Deprecated MorphiaIterator<T,T> fetch(FindOptions options)
Deprecated.usefind(FindOptions)
insteadExecute the query and get the results.- Parameters:
options
- the options to apply to the find operation- Returns:
- an Iterator of the results
- Since:
- 1.3
-
find
MorphiaCursor<T> find()
Execute the query and get the results. *note* the return type of this will change in 2.0.- Returns:
- a MorphiaCursor
- Since:
- 1.4
- See Also:
find(FindOptions)
-
find
MorphiaCursor<T> find(FindOptions options)
Execute the query and get the results.- Parameters:
options
- the options to apply to the find operation- Returns:
- a MorphiaCursor
- Since:
- 1.4
-
fetchEmptyEntities
@Deprecated MorphiaIterator<T,T> fetchEmptyEntities()
Deprecated.usekeys()
insteadExecute the query and get only the ids of the results. This is more efficient than fetching the actual results (transfers less data).- Returns:
- an Iterator of the empty entities
-
fetchEmptyEntities
@Deprecated MorphiaIterator<T,T> fetchEmptyEntities(FindOptions options)
Deprecated.usekeys(FindOptions)
insteadExecute the query and get only the ids of the results. This is more efficient than fetching the actual results (transfers less data).- Parameters:
options
- the options to apply to the find operation- Returns:
- an Iterator of the empty entities
- Since:
- 1.3
-
fetchKeys
@Deprecated MorphiaKeyIterator<T> fetchKeys()
Deprecated.usekeys()
Execute the query and get the keys for the objects.- Returns:
- the Key Iterator
- See Also:
fetchEmptyEntities()
-
fetchKeys
@Deprecated MorphiaKeyIterator<T> fetchKeys(FindOptions options)
Deprecated.Execute the query and get the keys for the objects.- Parameters:
options
- the options to apply to the find operation- Returns:
- the Key Iterator
- Since:
- 1.3
-
first
T first(FindOptions options)
Gets the first entity in the result set. Obeys theQuery
offset value.- Parameters:
options
- the options to apply to the find operation- Returns:
- the only instance in the result, or null if the result set is empty.
- Since:
- 1.5
-
get
@Deprecated T get()
Deprecated.useMongoIterable.first()
Gets the first entity in the result set. Obeys theQuery
offset value.- Returns:
- the only instance in the result, or null if the result set is empty.
-
get
@Deprecated T get(FindOptions options)
Deprecated.Gets the first entity in the result set. Obeys theQuery
offset value.- Parameters:
options
- the options to apply to the find operation- Returns:
- the only instance in the result, or null if the result set is empty.
- Since:
- 1.3
-
getKey
@Deprecated Key<T> getKey()
Deprecated.useMongoIterable.first()
insteadGet the key of the first entity in the result set. Obeys theQuery
offset value.- Returns:
- the key of the first instance in the result, or null if the result set is empty.
-
getKey
@Deprecated Key<T> getKey(FindOptions options)
Deprecated.useMongoIterable.first()
insteadGet the key of the first entity in the result set. Obeys theQuery
offset value.- Parameters:
options
- the options to apply to the find operation- Returns:
- the key of the first instance in the result, or null if the result set is empty.
- Since:
- 1.3
-
tail
@Deprecated MorphiaIterator<T,T> tail()
Deprecated.set the CursorType onFindOptions
and usefind(FindOptions)
insteadCallstail(true);
- Returns:
- an Iterator.
- See Also:
tail(boolean)
-
tail
@Deprecated MorphiaIterator<T,T> tail(boolean awaitData)
Deprecated.set the CursorType onFindOptions
and usefind(FindOptions)
instead. This can be replicated usingfindOptions.cursorType (awaitData ? TailableAwait : Tailable)
Returns an tailing iterator over a set of elements of type T. If awaitData is true, this iterator blocks on hasNext() until new data is avail (or some amount of time has passed). Note that if no data is available at all, hasNext() might return immediately. You should wrap tail calls in a loop if you want this to be blocking.- Parameters:
awaitData
- passes the awaitData to the cursor- Returns:
- an Iterator.
-
-