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 voidadd(Criteria... criteria)Adds Criteria to this containerCriteriaContainerand(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.voidattach(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.longcount()Count the total number of values in the result, ignoring limit and offsetlongcount(CountOptions options)Count the total number of values in the result, ignoring limit and offsetlongcountAll()Deprecated.FieldEnd<? extends CriteriaContainer>criteria(java.lang.String field)Creates a criteria against a fieldQuery<T>disableCursorTimeout()Deprecated.Query<T>disableSnapshotMode()Deprecated.Query<T>disableValidation()Turns off validation (for all calls made after)Query<T>enableCursorTimeout()Deprecated.Query<T>enableSnapshotMode()Deprecated.Query<T>enableValidation()Turns on validation (for all calls made after); by default validation is onbooleanequals(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.Tfirst()Tfirst(FindOptions options)Gets the first entity in the result set.voidforEach(com.mongodb.Block<? super T> block)Tget()Gets the first entity in the result set.Tget(FindOptions options)Gets the first entity in the result set.intgetBatchSize()Deprecated.com.mongodb.DBCollectiongetCollection()Deprecated.DatastoreImplgetDatastore()Deprecated.this is an internal method that exposes an internal type and will likely go away soonjava.lang.Class<T>getEntityClass()java.lang.StringgetFieldName()com.mongodb.DBObjectgetFieldsObject()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.intgetLimit()Deprecated.intgetOffset()Deprecated.com.mongodb.DBObjectgetQueryObject()Deprecated.com.mongodb.DBObjectgetSortObject()Deprecated.inthashCode()Query<T>hintIndex(java.lang.String idxName)Deprecated.<A extends java.util.Collection<? super T>>
Ainto(A target)booleanisValidatingNames()booleanisValidatingTypes()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)Deprecated.Query<T>maxTime(long value, java.util.concurrent.TimeUnit unit)Deprecated.Query<T>offset(int value)Deprecated.CriteriaContaineror(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.BasicDBObjectparseFieldsString(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.DBCursorprepareCursor()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.voidremove(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..voidsetQueryObject(com.mongodb.DBObject query)Sets query structure directlyMorphiaIterator<T,T>tail()Deprecated.MorphiaIterator<T,T>tail(boolean awaitData)Deprecated.com.mongodb.DBObjecttoDBObject()java.lang.StringtoString()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:QueryExecute the query and get the results (as aMorphiaCursor<Key<T>>)
-
keys
public MorphiaKeyCursor<T> keys(FindOptions options)
Description copied from interface:QueryExecute the query and get the results (as aMorphiaCursor<Key<T>>)
-
asKeyList
public java.util.List<Key<T>> asKeyList()
Description copied from interface:QueryExecute 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:QueryExecute 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:QueryExecute the query and get the results.
-
asList
public java.util.List<T> asList(FindOptions options)
Description copied from interface:QueryExecute the query and get the results.
-
countAll
@Deprecated public long countAll()
Deprecated.Description copied from interface:QueryCount the total number of values in the result, ignoring limit and offset
-
count
public long count()
Description copied from interface:QueryCount the total number of values in the result, ignoring limit and offset
-
count
public long count(CountOptions options)
Description copied from interface:QueryCount the total number of values in the result, ignoring limit and offset
-
fetch
public MorphiaIterator<T,T> fetch()
Description copied from interface:QueryExecute the query and get the results.
-
fetch
public MorphiaIterator<T,T> fetch(FindOptions options)
Description copied from interface:QueryExecute the query and get the results.
-
find
public MorphiaCursor<T> find()
Description copied from interface:QueryExecute the query and get the results. *note* the return type of this will change in 2.0.- Specified by:
findin interfaceQuery<T>- Returns:
- a MorphiaCursor
- See Also:
Query.find(FindOptions)
-
find
public MorphiaCursor<T> find(FindOptions options)
Description copied from interface:QueryExecute the query and get the results.
-
fetchEmptyEntities
public MorphiaIterator<T,T> fetchEmptyEntities()
Description copied from interface:QueryExecute the query and get only the ids of the results. This is more efficient than fetching the actual results (transfers less data).- Specified by:
fetchEmptyEntitiesin interfaceQuery<T>- Returns:
- an Iterator of the empty entities
-
fetchEmptyEntities
public MorphiaIterator<T,T> fetchEmptyEntities(FindOptions options)
Description copied from interface:QueryExecute the query and get only the ids of the results. This is more efficient than fetching the actual results (transfers less data).- Specified by:
fetchEmptyEntitiesin 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:QueryExecute the query and get the keys for the objects.- Specified by:
fetchKeysin interfaceQuery<T>- Returns:
- the Key Iterator
- See Also:
Query.fetchEmptyEntities()
-
fetchKeys
public MorphiaKeyIterator<T> fetchKeys(FindOptions options)
Description copied from interface:QueryExecute the query and get the keys for the objects.
-
first
public T first(FindOptions options)
Description copied from interface:QueryGets the first entity in the result set. Obeys theQueryoffset value.
-
get
public T get()
Description copied from interface:QueryGets the first entity in the result set. Obeys theQueryoffset value.
-
get
public T get(FindOptions options)
Description copied from interface:QueryGets the first entity in the result set. Obeys theQueryoffset value.
-
getKey
public Key<T> getKey()
Description copied from interface:QueryGet the key of the first entity in the result set. Obeys theQueryoffset value.
-
getKey
public Key<T> getKey(FindOptions options)
Description copied from interface:QueryGet the key of the first entity in the result set. Obeys theQueryoffset value.
-
tail
@Deprecated public MorphiaIterator<T,T> tail()
Deprecated.Description copied from interface:QueryCallstail(true);- Specified by:
tailin interfaceQuery<T>- Returns:
- an Iterator.
- See Also:
Query.tail(boolean)
-
tail
@Deprecated public MorphiaIterator<T,T> tail(boolean awaitData)
Deprecated.Description copied from interface:QueryReturns 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:QueryBatch-size of the fetched result (cursor).- Specified by:
batchSizein interfacecom.mongodb.client.MongoIterable<T>- Specified by:
batchSizein 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:QueryCreates and returns a copy of thisQuery.- Specified by:
cloneQueryin interfaceQuery<T>- Returns:
- this
-
comment
@Deprecated public Query<T> comment(java.lang.String comment)
Deprecated.Description copied from interface:QueryThis 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.- Specified by:
commentin interfaceQuery<T>- Parameters:
comment- the comment to add- Returns:
- the Query to enable chaining of commands
- See Also:
FindOptions.modifier(String, Object)
-
criteria
public FieldEnd<? extends CriteriaContainer> criteria(java.lang.String field)
Description copied from interface:CriteriaContainerCreates a criteria against a field- Specified by:
criteriain interfaceCriteriaContainer- Specified by:
criteriain 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:QueryDisables cursor timeout on server.- Specified by:
disableCursorTimeoutin interfaceQuery<T>- Returns:
- this
- See Also:
FindOptions.noCursorTimeout(boolean)
-
disableSnapshotMode
@Deprecated public Query<T> disableSnapshotMode()
Deprecated.Description copied from interface:QueryDisable snapshotted mode (default mode). This will be faster but changes made during the cursor may cause duplicates.- Specified by:
disableSnapshotModein interfaceQuery<T>- Returns:
- this
- See Also:
FindOptions.modifier(String, Object)
-
disableValidation
public Query<T> disableValidation()
Description copied from interface:QueryTurns off validation (for all calls made after)- Specified by:
disableValidationin interfaceQuery<T>- Returns:
- this
-
enableCursorTimeout
@Deprecated public Query<T> enableCursorTimeout()
Deprecated.Description copied from interface:QueryEnables cursor timeout on server.- Specified by:
enableCursorTimeoutin interfaceQuery<T>- Returns:
- this
- See Also:
FindOptions.noCursorTimeout(boolean)
-
enableSnapshotMode
@Deprecated public Query<T> enableSnapshotMode()
Deprecated.Description copied from interface:QueryEnables snapshotted mode where duplicate results (which may be updated during the lifetime of the cursor) will not be returned. Not compatible with order/sort and hint.- Specified by:
enableSnapshotModein interfaceQuery<T>- Returns:
- this
- See Also:
FindOptions.modifier(String, Object)
-
enableValidation
public Query<T> enableValidation()
Description copied from interface:QueryTurns on validation (for all calls made after); by default validation is on- Specified by:
enableValidationin interfaceQuery<T>- Returns:
- this
-
explain
public java.util.Map<java.lang.String,java.lang.Object> explain()
Description copied from interface:QueryProvides 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:QueryProvides 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:QueryFluent 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:QueryCreate 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:
getBatchSizein interfaceQuery<T>- Returns:
- the batch size
- See Also:
Query.batchSize(int),FindOptions.batchSize(int)
-
getCollection
@Deprecated public com.mongodb.DBCollection getCollection()
Deprecated.- Specified by:
getCollectionin interfaceQuery<T>- Returns:
- the collection this query targets
-
getEntityClass
public java.lang.Class<T> getEntityClass()
- Specified by:
getEntityClassin interfaceQuery<T>- Returns:
- the entity
Class.
-
getFieldsObject
@Deprecated public com.mongodb.DBObject getFieldsObject()
Deprecated.- Specified by:
getFieldsObjectin interfaceQuery<T>- Returns:
- the Mongo fields
DBObject.
-
getLimit
@Deprecated public int getLimit()
Deprecated.- Specified by:
getLimitin interfaceQuery<T>- Returns:
- the limit
- See Also:
Query.limit(int),FindOptions.limit(int)
-
getOffset
@Deprecated public int getOffset()
Deprecated.- Specified by:
getOffsetin interfaceQuery<T>- Returns:
- the offset.
- See Also:
Query.offset(int),FindOptions.getSkip()
-
getQueryObject
@Deprecated public com.mongodb.DBObject getQueryObject()
Deprecated.- Specified by:
getQueryObjectin 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:
getSortObjectin interfaceQuery<T>- Returns:
- the Mongo sort
DBObject.
-
hintIndex
@Deprecated public Query<T> hintIndex(java.lang.String idxName)
Deprecated.Description copied from interface:QueryHints as to which index should be used.- Specified by:
hintIndexin interfaceQuery<T>- Parameters:
idxName- the index name to hint- Returns:
- this
- See Also:
FindOptions.modifier(String, Object)
-
limit
@Deprecated public Query<T> limit(int value)
Deprecated.Description copied from interface:QueryLimit the fetched result set to a certain number of values.- Specified by:
limitin 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:QuerySpecify 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:
lowerIndexBoundin interfaceQuery<T>- Parameters:
lowerBound- The inclusive lower bound.- Returns:
- this
- See Also:
FindOptions.modifier(String, Object)
-
maxScan
@Deprecated public Query<T> maxScan(int value)
Deprecated.Description copied from interface:QueryConstrains the query to only scan the specified number of documents when fulfilling the query.- Specified by:
maxScanin interfaceQuery<T>- Parameters:
value- must be > 0. A value < 0 indicates no limit- Returns:
- this
- See Also:
FindOptions.modifier(String, Object)
-
maxTime
@Deprecated public Query<T> maxTime(long value, java.util.concurrent.TimeUnit unit)
Deprecated.Description copied from interface:QuerySpecifies a time limit for executing the query. Requires server version 2.6 or above.- Specified by:
maxTimein interfaceQuery<T>- Parameters:
value- must be > 0. A value < 0 indicates no limitunit- the unit of time to use- Returns:
- this
- See Also:
FindOptions.modifier(String, Object)
-
offset
@Deprecated public Query<T> offset(int value)
Deprecated.Description copied from interface:QueryStarts the query results at a particular zero-based offset.- Specified by:
offsetin 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:QuerySorts 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:QuerySorts 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:QuerySorts based on a specified sort keys (defines return order).
-
queryNonPrimary
@Deprecated public Query<T> queryNonPrimary()
Deprecated.Description copied from interface:QueryRoute query to non-primary node- Specified by:
queryNonPrimaryin 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:QueryRoute query to primary node- Specified by:
queryPrimaryOnlyin interfaceQuery<T>- Returns:
- this
- See Also:
ReadPreference.primary(),FindOptions.readPreference(ReadPreference),ReadPreference.primary(),ReadPreference.primaryPreferred()
-
retrieveKnownFields
public Query<T> retrieveKnownFields()
Description copied from interface:QueryLimits the fields retrieved to those of the query type -- dangerous with interfaces and abstract classes- Specified by:
retrieveKnownFieldsin interfaceQuery<T>- Returns:
- this
-
project
public Query<T> project(java.lang.String field, boolean include)
Description copied from interface:QueryAdds 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:
projectin 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:QueryAdds an sliced array field to a projection.- Specified by:
projectin 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:QueryAdds a metadata field to a projection.- Specified by:
projectin 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:QueryLimits the fields retrieved- Specified by:
retrievedFieldsin 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
-
returnKey
@Deprecated public Query<T> returnKey()
Deprecated.Description copied from interface:QueryOnly 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:
returnKeyin interfaceQuery<T>- Returns:
- the Query to enable chaining of commands
- See Also:
FindOptions.modifier(String, Object)
-
search
public Query<T> search(java.lang.String search)
Description copied from interface:QueryPerform 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:QueryPerform a text search on the content of the fields indexed with a text index..
-
upperIndexBound
@Deprecated public Query<T> upperIndexBound(com.mongodb.DBObject upperBound)
Deprecated.Description copied from interface:QuerySpecify 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:
upperIndexBoundin interfaceQuery<T>- Parameters:
upperBound- The exclusive upper bound.- Returns:
- this
- See Also:
FindOptions.modifier(String, Object)
-
useReadPreference
@Deprecated public Query<T> useReadPreference(com.mongodb.ReadPreference readPref)
Deprecated.Description copied from interface:QueryUpdates the ReadPreference to use- Specified by:
useReadPreferencein 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:QueryLimit the query using this javascript block; only one per query
-
where
public Query<T> where(org.bson.types.CodeWScope js)
Description copied from interface:QueryLimit the query using this javascript block; only one per query
-
getFieldName
public java.lang.String getFieldName()
- Specified by:
getFieldNamein 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()
-
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:
mapin interfacecom.mongodb.client.MongoIterable<T>
-
forEach
public void forEach(com.mongodb.Block<? super T> block)
- Specified by:
forEachin interfacecom.mongodb.client.MongoIterable<T>
-
into
public <A extends java.util.Collection<? super T>> A into(A target)
- Specified by:
intoin interfacecom.mongodb.client.MongoIterable<T>
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
add
public void add(Criteria... criteria)
Description copied from interface:CriteriaContainerAdds Criteria to this container- Specified by:
addin interfaceCriteriaContainer- Parameters:
criteria- the criteria to add
-
and
public CriteriaContainer and(Criteria... criteria)
Description copied from interface:CriteriaContainerAnds Criteria with this CriteriaContainer.- Specified by:
andin interfaceCriteriaContainer- Specified by:
andin interfaceQuery<T>- Parameters:
criteria- the criteria- Returns:
- the container
-
or
public CriteriaContainer or(Criteria... criteria)
Description copied from interface:CriteriaContainerOrs Criteria with this CriteriaContainer.- Specified by:
orin interfaceCriteriaContainer- Specified by:
orin interfaceQuery<T>- Parameters:
criteria- the criteria- Returns:
- the container
-
toDBObject
public com.mongodb.DBObject toDBObject()
- Specified by:
toDBObjectin interfaceCriteria- Returns:
- the DBObject form of this type
-
remove
public void remove(Criteria criteria)
Description copied from interface:CriteriaContainerRemoves Criteria to this container- Specified by:
removein interfaceCriteriaContainer- Parameters:
criteria- the criteria to remove
-
attach
public void attach(CriteriaContainer container)
Description copied from interface:CriteriaUsed to add this Criteria to a CriteriaContainer
-
-