Package dev.morphia.query
Class QueryImpl<T>
- java.lang.Object
-
- dev.morphia.query.QueryImpl<T>
-
- Type Parameters:
T
- The type we will be querying for, and returning.
- All Implemented Interfaces:
com.mongodb.client.MongoIterable<T>
,Criteria
,CriteriaContainer
,Query<T>
,QueryResults<T>
,java.lang.Iterable<T>
public class QueryImpl<T> extends java.lang.Object implements CriteriaContainer, Query<T>
Implementation of Query
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
add(Criteria... criteria)
Adds Criteria to this containerCriteriaContainer
and(Criteria... criteria)
Ands Criteria with this CriteriaContainer.java.util.List<Key<T>>
asKeyList()
Execute the query and get the results (as aList<Key<T>>
) This method is provided as a convenience;java.util.List<Key<T>>
asKeyList(FindOptions options)
Execute the query and get the results (as aList<Key<T>>
) This method is provided as a convenience;java.util.List<T>
asList()
Execute the query and get the results.java.util.List<T>
asList(FindOptions options)
Execute the query and get the results.void
attach(CriteriaContainer container)
Used to add this Criteria to a CriteriaContainerQuery<T>
batchSize(int value)
Deprecated.QueryImpl<T>
cloneQuery()
Creates and returns a copy of thisQuery
.Query<T>
comment(java.lang.String comment)
Deprecated.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.FieldEnd<? extends CriteriaContainer>
criteria(java.lang.String field)
Creates a criteria against a fieldcom.mongodb.client.MongoCursor<T>
cursor()
Query<T>
disableCursorTimeout()
Deprecated.Query<T>
disableValidation()
Turns off validation (for all calls made after)Query<T>
enableCursorTimeout()
Deprecated.Query<T>
enableValidation()
Turns on validation (for all calls made after); by default validation is onboolean
equals(java.lang.Object o)
java.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()
Execute the query and get the results.MorphiaIterator<T,T>
fetch(FindOptions options)
Execute the query and get the results.MorphiaIterator<T,T>
fetchEmptyEntities()
Execute the query and get only the ids of the results.MorphiaIterator<T,T>
fetchEmptyEntities(FindOptions options)
Execute the query and get only the ids of the results.MorphiaKeyIterator<T>
fetchKeys()
Execute the query and get the keys for the objects.MorphiaKeyIterator<T>
fetchKeys(FindOptions options)
Execute the query and get the keys for the objects.FieldEnd<? extends Query<T>>
field(java.lang.String name)
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()
T
first(FindOptions options)
Gets the first entity in the result set.void
forEach(java.util.function.Consumer<? super T> block)
T
get()
Gets the first entity in the result set.T
get(FindOptions options)
Gets the first entity in the result set.int
getBatchSize()
Deprecated.com.mongodb.DBCollection
getCollection()
Deprecated.DatastoreImpl
getDatastore()
Deprecated.this is an internal method that exposes an internal type and will likely go away soonjava.lang.Class<T>
getEntityClass()
java.lang.String
getFieldName()
com.mongodb.DBObject
getFieldsObject()
Deprecated.Key<T>
getKey()
Get the key of the first entity in the result set.Key<T>
getKey(FindOptions options)
Get the key of the first entity in the result set.int
getLimit()
Deprecated.int
getOffset()
Deprecated.com.mongodb.DBObject
getQueryObject()
Deprecated.com.mongodb.DBObject
getSortObject()
Deprecated.int
hashCode()
Query<T>
hintIndex(java.lang.String idxName)
Deprecated.<A extends java.util.Collection<? super T>>
Ainto(A target)
boolean
isValidatingNames()
boolean
isValidatingTypes()
com.mongodb.client.MongoCursor<T>
iterator()
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.Query<T>
lowerIndexBound(com.mongodb.DBObject lowerBound)
Deprecated.<U> com.mongodb.client.MongoIterable<U>
map(com.mongodb.Function<T,U> mapper)
Query<T>
maxScan(int value)
Constrains the query to only scan the specified number of documents when fulfilling the query.Query<T>
maxTime(long value, java.util.concurrent.TimeUnit unit)
Deprecated.Query<T>
offset(int value)
Deprecated.CriteriaContainer
or(Criteria... criteria)
Ors Criteria with this CriteriaContainer.Query<T>
order(Meta sort)
Sorts based on a metadata (defines return order).Query<T>
order(Sort... sorts)
Sorts based on a specified sort keys (defines return order).Query<T>
order(java.lang.String sort)
Sorts based on a property (defines return order).static com.mongodb.BasicDBObject
parseFieldsString(java.lang.String str, java.lang.Class clazz, Mapper mapper, boolean validate)
Deprecated.this is an internal method and will be removed in the next versioncom.mongodb.DBCursor
prepareCursor()
Deprecated.this is an internal method.Query<T>
project(Meta meta)
Adds a metadata field to a projection.Query<T>
project(java.lang.String field, boolean include)
Adds a field to the projection clause.Query<T>
project(java.lang.String field, ArraySlice slice)
Adds an sliced array field to a projection.Query<T>
queryNonPrimary()
Deprecated.Query<T>
queryPrimaryOnly()
Deprecated.void
remove(Criteria criteria)
Removes Criteria to this containerQuery<T>
retrievedFields(boolean include, java.lang.String... list)
Deprecated.Query<T>
retrieveKnownFields()
Limits the fields retrieved to those of the query type -- dangerous with interfaces and abstract classesQuery<T>
returnKey()
Deprecated.Query<T>
search(java.lang.String search)
Perform a text search on the content of the fields indexed with a text index..Query<T>
search(java.lang.String search, java.lang.String language)
Perform a text search on the content of the fields indexed with a text index..void
setQueryObject(com.mongodb.DBObject query)
Sets query structure directlyMorphiaIterator<T,T>
tail()
Deprecated.MorphiaIterator<T,T>
tail(boolean awaitData)
Deprecated.com.mongodb.DBObject
toDBObject()
java.lang.String
toString()
Query<T>
upperIndexBound(com.mongodb.DBObject upperBound)
Deprecated.Query<T>
useReadPreference(com.mongodb.ReadPreference readPref)
Deprecated.Query<T>
where(java.lang.String js)
Limit the query using this javascript block; only one per queryQuery<T>
where(org.bson.types.CodeWScope js)
Limit the query using this javascript block; only one per query
-
-
-
Method Detail
-
parseFieldsString
@Deprecated public static com.mongodb.BasicDBObject parseFieldsString(java.lang.String str, java.lang.Class clazz, Mapper mapper, boolean validate)
Deprecated.this is an internal method and will be removed in the next versionParses the string and validates each part- Parameters:
str
- the String to parseclazz
- the class to use when validatingmapper
- the Mapper to usevalidate
- true if the results should be validated- Returns:
- the DBObject
-
keys
public MorphiaKeyCursor<T> keys()
Description copied from interface:Query
Execute the query and get the results (as aMorphiaCursor<Key<T>>
)
-
keys
public MorphiaKeyCursor<T> keys(FindOptions options)
Description copied from interface:Query
Execute the query and get the results (as aMorphiaCursor<Key<T>>
)
-
asKeyList
public java.util.List<Key<T>> asKeyList()
Description copied from interface:Query
Execute the query and get the results (as aList<Key<T>>
) This method is provided as a convenience;
-
asKeyList
public java.util.List<Key<T>> asKeyList(FindOptions options)
Description copied from interface:Query
Execute the query and get the results (as aList<Key<T>>
) This method is provided as a convenience;
-
asList
public java.util.List<T> asList()
Description copied from interface:Query
Execute the query and get the results.
-
asList
public java.util.List<T> asList(FindOptions options)
Description copied from interface:Query
Execute the query and get the results.
-
countAll
@Deprecated public long countAll()
Deprecated.Description copied from interface:Query
Count the total number of values in the result, ignoring limit and offset
-
count
public long count()
Description copied from interface:Query
Count the total number of values in the result, ignoring limit and offset
-
count
public long count(CountOptions options)
Description copied from interface:Query
Count the total number of values in the result, ignoring limit and offset
-
fetch
public MorphiaIterator<T,T> fetch()
Description copied from interface:Query
Execute the query and get the results.
-
fetch
public MorphiaIterator<T,T> fetch(FindOptions options)
Description copied from interface:Query
Execute the query and get the results.
-
find
public MorphiaCursor<T> find()
Description copied from interface:Query
Execute the query and get the results. *note* the return type of this will change in 2.0.- Specified by:
find
in interfaceQuery<T>
- Returns:
- a MorphiaCursor
- See Also:
Query.find(FindOptions)
-
find
public MorphiaCursor<T> find(FindOptions options)
Description copied from interface:Query
Execute the query and get the results.
-
fetchEmptyEntities
public MorphiaIterator<T,T> fetchEmptyEntities()
Description copied from interface:Query
Execute the query and get only the ids of the results. This is more efficient than fetching the actual results (transfers less data).- Specified by:
fetchEmptyEntities
in interfaceQuery<T>
- Returns:
- an Iterator of the empty entities
-
fetchEmptyEntities
public MorphiaIterator<T,T> fetchEmptyEntities(FindOptions options)
Description copied from interface:Query
Execute the query and get only the ids of the results. This is more efficient than fetching the actual results (transfers less data).- Specified by:
fetchEmptyEntities
in interfaceQuery<T>
- Parameters:
options
- the options to apply to the find operation- Returns:
- an Iterator of the empty entities
-
fetchKeys
public MorphiaKeyIterator<T> fetchKeys()
Description copied from interface:Query
Execute the query and get the keys for the objects.- Specified by:
fetchKeys
in interfaceQuery<T>
- Returns:
- the Key Iterator
- See Also:
Query.fetchEmptyEntities()
-
fetchKeys
public MorphiaKeyIterator<T> fetchKeys(FindOptions options)
Description copied from interface:Query
Execute the query and get the keys for the objects.
-
first
public T first(FindOptions options)
Description copied from interface:Query
Gets the first entity in the result set. Obeys theQuery
offset value.
-
get
public T get()
Description copied from interface:Query
Gets the first entity in the result set. Obeys theQuery
offset value.
-
get
public T get(FindOptions options)
Description copied from interface:Query
Gets the first entity in the result set. Obeys theQuery
offset value.
-
getKey
public Key<T> getKey()
Description copied from interface:Query
Get the key of the first entity in the result set. Obeys theQuery
offset value.
-
getKey
public Key<T> getKey(FindOptions options)
Description copied from interface:Query
Get the key of the first entity in the result set. Obeys theQuery
offset value.
-
tail
@Deprecated public MorphiaIterator<T,T> tail()
Deprecated.Description copied from interface:Query
Callstail(true);
- Specified by:
tail
in interfaceQuery<T>
- Returns:
- an Iterator.
- See Also:
Query.tail(boolean)
-
tail
@Deprecated public MorphiaIterator<T,T> tail(boolean awaitData)
Deprecated.Description copied from interface:Query
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.
-
batchSize
@Deprecated public Query<T> batchSize(int value)
Deprecated.Description copied from interface:Query
Batch-size of the fetched result (cursor).- Specified by:
batchSize
in interfacecom.mongodb.client.MongoIterable<T>
- Specified by:
batchSize
in interfaceQuery<T>
- Parameters:
value
- must be >= 0. A value of 0 indicates the server default.- Returns:
- this
- See Also:
FindOptions.batchSize(int)
-
cloneQuery
public QueryImpl<T> cloneQuery()
Description copied from interface:Query
Creates and returns a copy of thisQuery
.- Specified by:
cloneQuery
in interfaceQuery<T>
- Returns:
- this
-
comment
@Deprecated public Query<T> comment(java.lang.String comment)
Deprecated.Description copied from interface:Query
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.
-
criteria
public FieldEnd<? extends CriteriaContainer> criteria(java.lang.String field)
Description copied from interface:CriteriaContainer
Creates a criteria against a field- Specified by:
criteria
in interfaceCriteriaContainer
- Specified by:
criteria
in interfaceQuery<T>
- Parameters:
field
- the field- Returns:
- the FieldEnd to define the criteria to apply
-
disableCursorTimeout
@Deprecated public Query<T> disableCursorTimeout()
Deprecated.Description copied from interface:Query
Disables cursor timeout on server.- Specified by:
disableCursorTimeout
in interfaceQuery<T>
- Returns:
- this
- See Also:
FindOptions.noCursorTimeout(boolean)
-
disableValidation
public Query<T> disableValidation()
Description copied from interface:Query
Turns off validation (for all calls made after)- Specified by:
disableValidation
in interfaceQuery<T>
- Returns:
- this
-
enableCursorTimeout
@Deprecated public Query<T> enableCursorTimeout()
Deprecated.Description copied from interface:Query
Enables cursor timeout on server.- Specified by:
enableCursorTimeout
in interfaceQuery<T>
- Returns:
- this
- See Also:
FindOptions.noCursorTimeout(boolean)
-
enableValidation
public Query<T> enableValidation()
Description copied from interface:Query
Turns on validation (for all calls made after); by default validation is on- Specified by:
enableValidation
in interfaceQuery<T>
- Returns:
- this
-
explain
public java.util.Map<java.lang.String,java.lang.Object> explain()
Description copied from interface:Query
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.
-
explain
public java.util.Map<java.lang.String,java.lang.Object> explain(FindOptions options)
Description copied from interface:Query
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.
-
field
public FieldEnd<? extends Query<T>> field(java.lang.String name)
Description copied from interface:Query
Fluent query interface:createQuery(Ent.class).field("count").greaterThan(7)...
-
filter
public Query<T> filter(java.lang.String condition, java.lang.Object value)
Description copied from interface:Query
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
.
-
getBatchSize
@Deprecated public int getBatchSize()
Deprecated.- Specified by:
getBatchSize
in interfaceQuery<T>
- Returns:
- the batch size
- See Also:
Query.batchSize(int)
,FindOptions.batchSize(int)
-
getCollection
@Deprecated public com.mongodb.DBCollection getCollection()
Deprecated.- Specified by:
getCollection
in interfaceQuery<T>
- Returns:
- the collection this query targets
-
getEntityClass
public java.lang.Class<T> getEntityClass()
- Specified by:
getEntityClass
in interfaceQuery<T>
- Returns:
- the entity
Class
.
-
getFieldsObject
@Deprecated public com.mongodb.DBObject getFieldsObject()
Deprecated.- Specified by:
getFieldsObject
in interfaceQuery<T>
- Returns:
- the Mongo fields
DBObject
.
-
getLimit
@Deprecated public int getLimit()
Deprecated.- Specified by:
getLimit
in interfaceQuery<T>
- Returns:
- the limit
- See Also:
Query.limit(int)
,FindOptions.limit(int)
-
getOffset
@Deprecated public int getOffset()
Deprecated.- Specified by:
getOffset
in interfaceQuery<T>
- Returns:
- the offset.
- See Also:
Query.offset(int)
,FindOptions.getSkip()
-
getQueryObject
@Deprecated public com.mongodb.DBObject getQueryObject()
Deprecated.- Specified by:
getQueryObject
in interfaceQuery<T>
- Returns:
- the Mongo query
DBObject
.
-
setQueryObject
public void setQueryObject(com.mongodb.DBObject query)
Sets query structure directly- Parameters:
query
- the DBObject containing the query
-
getSortObject
@Deprecated public com.mongodb.DBObject getSortObject()
Deprecated.- Specified by:
getSortObject
in interfaceQuery<T>
- Returns:
- the Mongo sort
DBObject
.
-
hintIndex
@Deprecated public Query<T> hintIndex(java.lang.String idxName)
Deprecated.Description copied from interface:Query
Hints as to which index should be used.- Specified by:
hintIndex
in interfaceQuery<T>
- Parameters:
idxName
- the index name to hint- Returns:
- this
- See Also:
FindOptions.hint(DBObject)
-
limit
@Deprecated public Query<T> limit(int value)
Deprecated.Description copied from interface:Query
Limit the fetched result set to a certain number of values.- Specified by:
limit
in interfaceQuery<T>
- 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 public Query<T> lowerIndexBound(com.mongodb.DBObject lowerBound)
Deprecated.Description copied from interface:Query
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"}
- Specified by:
lowerIndexBound
in interfaceQuery<T>
- Parameters:
lowerBound
- The inclusive lower bound.- Returns:
- this
- See Also:
FindOptions.min(DBObject)
-
forEach
public void forEach(java.util.function.Consumer<? super T> block)
- Specified by:
forEach
in interfacejava.lang.Iterable<T>
-
maxTime
@Deprecated public Query<T> maxTime(long value, java.util.concurrent.TimeUnit unit)
Deprecated.Description copied from interface:Query
Specifies a time limit for executing the query. Requires server version 2.6 or above.- Specified by:
maxTime
in interfaceQuery<T>
- Parameters:
value
- must be > 0. A value < 0 indicates no limitunit
- the unit of time to use- Returns:
- this
- See Also:
FindOptions.maxTime(long, TimeUnit)
-
offset
@Deprecated public Query<T> offset(int value)
Deprecated.Description copied from interface:Query
Starts the query results at a particular zero-based offset.- Specified by:
offset
in interfaceQuery<T>
- Parameters:
value
- must be >= 0- Returns:
- this
- See Also:
FindOptions.skip(int)
-
order
public Query<T> order(java.lang.String sort)
Description copied from interface:Query
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)
-
order
public Query<T> order(Meta sort)
Description copied from interface:Query
Sorts based on a metadata (defines return order). Example:order(Meta.textScore())
({textScore : { $meta: "textScore" }})
-
order
public Query<T> order(Sort... sorts)
Description copied from interface:Query
Sorts based on a specified sort keys (defines return order).
-
queryNonPrimary
@Deprecated public Query<T> queryNonPrimary()
Deprecated.Description copied from interface:Query
Route query to non-primary node- Specified by:
queryNonPrimary
in interfaceQuery<T>
- Returns:
- this
- See Also:
ReadPreference.secondary()
,ReadPreference.secondaryPreferred()
,FindOptions.readPreference(ReadPreference)
,ReadPreference.secondary()
,ReadPreference.secondaryPreferred()
-
queryPrimaryOnly
@Deprecated public Query<T> queryPrimaryOnly()
Deprecated.Description copied from interface:Query
Route query to primary node- Specified by:
queryPrimaryOnly
in interfaceQuery<T>
- Returns:
- this
- See Also:
ReadPreference.primary()
,FindOptions.readPreference(ReadPreference)
,ReadPreference.primary()
,ReadPreference.primaryPreferred()
-
retrieveKnownFields
public Query<T> retrieveKnownFields()
Description copied from interface:Query
Limits the fields retrieved to those of the query type -- dangerous with interfaces and abstract classes- Specified by:
retrieveKnownFields
in interfaceQuery<T>
- Returns:
- this
-
project
public Query<T> project(java.lang.String field, boolean include)
Description copied from interface:Query
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.- Specified by:
project
in interfaceQuery<T>
- 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
public Query<T> project(java.lang.String field, ArraySlice slice)
Description copied from interface:Query
Adds an sliced array field to a projection.- Specified by:
project
in interfaceQuery<T>
- Parameters:
field
- the field to projectslice
- the options for projecting an array field- Returns:
- this
- See Also:
- Project Fields to Return from Query
-
project
public Query<T> project(Meta meta)
Description copied from interface:Query
Adds a metadata field to a projection.- Specified by:
project
in interfaceQuery<T>
- Parameters:
meta
- the metadata option for projecting- Returns:
- this
- See Also:
- Project Fields to Return from Query
-
retrievedFields
@Deprecated public Query<T> retrievedFields(boolean include, java.lang.String... list)
Deprecated.Description copied from interface:Query
Limits the fields retrieved- Specified by:
retrievedFields
in interfaceQuery<T>
- Parameters:
include
- true if the fields should be included in the results. false to exclude them.list
- the fields in question- Returns:
- this
-
into
public <A extends java.util.Collection<? super T>> A into(A target)
- Specified by:
into
in interfacecom.mongodb.client.MongoIterable<T>
-
search
public Query<T> search(java.lang.String search)
Description copied from interface:Query
Perform a text search on the content of the fields indexed with a text index..
-
search
public Query<T> search(java.lang.String search, java.lang.String language)
Description copied from interface:Query
Perform a text search on the content of the fields indexed with a text index..
-
maxScan
public Query<T> maxScan(int value)
Description copied from interface:Query
Constrains the query to only scan the specified number of documents when fulfilling the query.
-
useReadPreference
@Deprecated public Query<T> useReadPreference(com.mongodb.ReadPreference readPref)
Deprecated.Description copied from interface:Query
Updates the ReadPreference to use- Specified by:
useReadPreference
in interfaceQuery<T>
- Parameters:
readPref
- the ReadPreference to use- Returns:
- this
- See Also:
ReadPreference
,FindOptions.readPreference(ReadPreference)
-
where
public Query<T> where(java.lang.String js)
Description copied from interface:Query
Limit the query using this javascript block; only one per query
-
where
public Query<T> where(org.bson.types.CodeWScope js)
Description copied from interface:Query
Limit the query using this javascript block; only one per query
-
getFieldName
public java.lang.String getFieldName()
- Specified by:
getFieldName
in interfaceCriteria
- Returns:
- the field name for the criteria
-
getDatastore
@Deprecated public DatastoreImpl getDatastore()
Deprecated.this is an internal method that exposes an internal type and will likely go away soon- Returns:
- the Datastore
-
isValidatingNames
public boolean isValidatingNames()
- Returns:
- true if field names are being validated
-
isValidatingTypes
public boolean isValidatingTypes()
- Returns:
- true if query parameter value types are being validated against the field types
-
iterator
public com.mongodb.client.MongoCursor<T> iterator()
-
cursor
public com.mongodb.client.MongoCursor<T> cursor()
- Specified by:
cursor
in interfacecom.mongodb.client.MongoIterable<T>
-
prepareCursor
@Deprecated public com.mongodb.DBCursor prepareCursor()
Deprecated.this is an internal method. no replacement is planned.Prepares cursor for iteration- Returns:
- the cursor
-
map
public <U> com.mongodb.client.MongoIterable<U> map(com.mongodb.Function<T,U> mapper)
- Specified by:
map
in interfacecom.mongodb.client.MongoIterable<T>
-
returnKey
@Deprecated public Query<T> returnKey()
Deprecated.Description copied from interface:Query
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- Specified by:
returnKey
in interfaceQuery<T>
- Returns:
- the Query to enable chaining of commands
- See Also:
FindOptions.returnKey(boolean)
-
upperIndexBound
@Deprecated public Query<T> upperIndexBound(com.mongodb.DBObject upperBound)
Deprecated.Description copied from interface:Query
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"}
- Specified by:
upperIndexBound
in interfaceQuery<T>
- Parameters:
upperBound
- The exclusive upper bound.- Returns:
- this
- See Also:
FindOptions.max(DBObject)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
add
public void add(Criteria... criteria)
Description copied from interface:CriteriaContainer
Adds Criteria to this container- Specified by:
add
in interfaceCriteriaContainer
- Parameters:
criteria
- the criteria to add
-
and
public CriteriaContainer and(Criteria... criteria)
Description copied from interface:CriteriaContainer
Ands Criteria with this CriteriaContainer.- Specified by:
and
in interfaceCriteriaContainer
- Specified by:
and
in interfaceQuery<T>
- Parameters:
criteria
- the criteria- Returns:
- the container
-
or
public CriteriaContainer or(Criteria... criteria)
Description copied from interface:CriteriaContainer
Ors Criteria with this CriteriaContainer.- Specified by:
or
in interfaceCriteriaContainer
- Specified by:
or
in interfaceQuery<T>
- Parameters:
criteria
- the criteria- Returns:
- the container
-
toDBObject
public com.mongodb.DBObject toDBObject()
- Specified by:
toDBObject
in interfaceCriteria
- Returns:
- the DBObject form of this type
-
remove
public void remove(Criteria criteria)
Description copied from interface:CriteriaContainer
Removes Criteria to this container- Specified by:
remove
in interfaceCriteriaContainer
- Parameters:
criteria
- the criteria to remove
-
attach
public void attach(CriteriaContainer container)
Description copied from interface:Criteria
Used to add this Criteria to a CriteriaContainer
-
-