Package dev.morphia.query
Class LegacyQuery<T>
- java.lang.Object
-
- dev.morphia.query.LegacyQuery<T>
-
- Type Parameters:
T- The type we will be querying for, and returning.
- All Implemented Interfaces:
Criteria,CriteriaContainer,Query<T>,Iterable<T>
@MorphiaInternal @Deprecated public class LegacyQuery<T> extends Object implements CriteriaContainer, Query<T>
Deprecated.Implementation of QueryDeveloper note.This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedLegacyQuery(Datastore datastore, String collectionName, Class<T> type, FindOptions options)Deprecated.Creates a Query for the given type and collection
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidadd(Criteria... criteria)Deprecated.Adds Criteria to this containerCriteriaContainerand(Criteria... criteria)Deprecated.Ands Criteria with this CriteriaContainer.voidattach(CriteriaContainer container)Deprecated.Used to add this Criteria to a CriteriaContainerlongcount()Deprecated.Count the total number of values in the result, ignoring limit and offsetlongcount(CountOptions options)Deprecated.Count the total number of values in the result, ignoring limit and offsetFieldEnd<? extends CriteriaContainer>criteria(String field)Deprecated.Creates a criteria against a fieldDeleteResultdelete(DeleteOptions options)Deprecated.Deletes documents matching this query.Query<T>disableValidation()Deprecated.Turns off validation (for all calls made after)Query<T>enableValidation()Deprecated.Turns on validation (for all calls made after); by default validation is onbooleanequals(Object o)Deprecated.dev.morphia.query.internal.MorphiaCursor<T>execute()Deprecated, for removal: This API element is subject to removal in a future version.dev.morphia.query.internal.MorphiaCursor<T>execute(FindOptions options)Deprecated, for removal: This API element is subject to removal in a future version.Map<String,Object>explain()Deprecated.Provides information on the query plan.Map<String,Object>explain(ExplainVerbosity verbosity)Deprecated.Provides information on the query plan.Map<String,Object>explain(FindOptions options, ExplainVerbosity verbosity)Deprecated.Provides information on the query plan.FieldEnd<? extends Query<T>>field(String name)Deprecated.Fluent query interface:createQuery(Ent.class).field("count").greaterThan(7)...Query<T>filter(String condition, Object value)Deprecated.Create a filter based on the specified condition and value.TfindAndDelete(FindAndDeleteOptions options)Deprecated.Deletes an entity from the database and returns it.Tfirst()Deprecated.Gets the first entity in the result set.Tfirst(FindOptions options)Deprecated.Gets the first entity in the result set.protected DatastoregetDatastore()Deprecated.Class<T>getEntityClass()Deprecated.StringgetFieldName()Deprecated.DocumentgetFieldsObject()Deprecated.StringgetLoggedQuery()Deprecated.DocumentgetSort()Deprecated.inthashCode()Deprecated.voidinvalid(ValidationException e)Deprecated.booleanisValidate()Deprecated.booleanisValidatingNames()Deprecated.dev.morphia.query.internal.MorphiaCursor<T>iterator()Deprecated.Execute the query and get the results.dev.morphia.query.internal.MorphiaCursor<T>iterator(FindOptions options)Deprecated.Execute the query and get the results.dev.morphia.query.internal.MorphiaKeyCursor<T>keys()Deprecated.Execute the query and get the results (as aMorphiaCursor<Key<T>>)dev.morphia.query.internal.MorphiaKeyCursor<T>keys(FindOptions options)Deprecated.Execute the query and get the results (as aMorphiaCursor<Key<T>>)Tmodify(ModifyOptions options, UpdateOperator... updates)Deprecated.Create a modify operation based on this queryModify<T>modify(UpdateOperations<T> operations)Deprecated.Modify<T>modify(UpdateOperator first, UpdateOperator... updates)Deprecated.Create a modify operation based on this queryCriteriaContaineror(Criteria... criteria)Deprecated.Ors Criteria with this CriteriaContainer.voidremove(Criteria criteria)Deprecated.Removes Criteria to this containerQuery<T>retrieveKnownFields()Deprecated.Limits the fields retrieved to those of the query type -- dangerous with interfaces and abstract classesQuery<T>search(String search)Deprecated.Perform a text search on the content of the fields indexed with a text index..Query<T>search(String search, String language)Deprecated.Perform a text search on the content of the fields indexed with a text index..voidsetQueryObject(Document query)Deprecated.Sets query structure directlyDocumenttoDocument()Deprecated.Converts the query to a Document and updates for any discriminator values as my be necessaryStringtoString()Deprecated.Update<T>update(UpdateOperations<T> operations)Deprecated, for removal: This API element is subject to removal in a future version.Update<T>update(UpdateOperator first, UpdateOperator... updates)Deprecated.Creates an update operation based on this queryUpdateResultupdate(UpdateOptions options, Stage... updates)Deprecated.Creates an update operation based on this queryUpdateResultupdate(UpdateOptions options, UpdateOperator... updates)Deprecated.Creates an update operation based on this queryUpdate<T>update(List<UpdateOperator> updates)Deprecated.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
add
public void add(Criteria... criteria)
Deprecated.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)
Deprecated.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
-
criteria
public FieldEnd<? extends CriteriaContainer> criteria(String field)
Deprecated.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
-
invalid
@MorphiaInternal public void invalid(ValidationException e)
Deprecated.
-
or
public CriteriaContainer or(Criteria... criteria)
Deprecated.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
-
remove
public void remove(Criteria criteria)
Deprecated.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)
Deprecated.Description copied from interface:CriteriaUsed to add this Criteria to a CriteriaContainer
-
getFieldName
public String getFieldName()
Deprecated.- Specified by:
getFieldNamein interfaceCriteria- Returns:
- the field name for the criteria
-
count
public long count(CountOptions options)
Deprecated.Description copied from interface:QueryCount the total number of values in the result, ignoring limit and offset
-
count
public long count()
Deprecated.Description copied from interface:QueryCount the total number of values in the result, ignoring limit and offset
-
execute
@Deprecated(since="2.0", forRemoval=true) public dev.morphia.query.internal.MorphiaCursor<T> execute()
Deprecated, for removal: This API element is subject to removal in a future version.Execute the query and get the results.- Specified by:
executein interfaceQuery<T>- Returns:
- a MorphiaCursor
- See Also:
iterator(FindOptions)
-
delete
public DeleteResult delete(DeleteOptions options)
Deprecated.Description copied from interface:QueryDeletes documents matching this query. Optionally deleting the first or all matched documents.
-
explain
public Map<String,Object> explain()
Deprecated.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 Map<String,Object> explain(ExplainVerbosity verbosity)
Deprecated.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 Map<String,Object> explain(FindOptions options, @Nullable ExplainVerbosity verbosity)
Deprecated.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.
-
disableValidation
public Query<T> disableValidation()
Deprecated.Description copied from interface:QueryTurns off validation (for all calls made after)- Specified by:
disableValidationin interfaceQuery<T>- Returns:
- this
-
enableValidation
public Query<T> enableValidation()
Deprecated.Description copied from interface:QueryTurns on validation (for all calls made after); by default validation is on- Specified by:
enableValidationin interfaceQuery<T>- Returns:
- this
-
execute
@Deprecated(since="2.0", forRemoval=true) public dev.morphia.query.internal.MorphiaCursor<T> execute(FindOptions options)
Deprecated, for removal: This API element is subject to removal in a future version.Execute the query and get the results.
-
getLoggedQuery
public String getLoggedQuery()
Deprecated.- Specified by:
getLoggedQueryin interfaceQuery<T>- Returns:
- The query logged during the previous execution of this query
-
field
public FieldEnd<? extends Query<T>> field(String name)
Deprecated.Description copied from interface:QueryFluent query interface:createQuery(Ent.class).field("count").greaterThan(7)...
-
filter
public Query<T> filter(String condition, Object value)
Deprecated.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
.
-
findAndDelete
public T findAndDelete(FindAndDeleteOptions options)
Deprecated.Description copied from interface:QueryDeletes an entity from the database and returns it.- Specified by:
findAndDeletein interfaceQuery<T>- Parameters:
options- the options to apply- Returns:
- the deleted entity
-
getEntityClass
@MorphiaInternal public Class<T> getEntityClass()
Deprecated.- Specified by:
getEntityClassin interfaceQuery<T>- 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.
-
first
public T first()
Deprecated.Description copied from interface:QueryGets the first entity in the result set. Obeys theQueryoffset value.
-
first
public T first(FindOptions options)
Deprecated.Description copied from interface:QueryGets the first entity in the result set. Obeys theQueryoffset value.
-
modify
public Modify<T> modify(UpdateOperator first, UpdateOperator... updates)
Deprecated.Description copied from interface:QueryCreate a modify operation based on this query
-
modify
public T modify(ModifyOptions options, UpdateOperator... updates)
Deprecated.Description copied from interface:QueryCreate a modify operation based on this query
-
isValidate
@MorphiaInternal public boolean isValidate()
Deprecated.
-
iterator
public dev.morphia.query.internal.MorphiaCursor<T> iterator()
Deprecated.Description copied from interface:QueryExecute the query and get the results.
-
iterator
public dev.morphia.query.internal.MorphiaCursor<T> iterator(FindOptions options)
Deprecated.Description copied from interface:QueryExecute the query and get the results.
-
keys
public dev.morphia.query.internal.MorphiaKeyCursor<T> keys(FindOptions options)
Deprecated.Description copied from interface:QueryExecute the query and get the results (as aMorphiaCursor<Key<T>>)
-
keys
public dev.morphia.query.internal.MorphiaKeyCursor<T> keys()
Deprecated.Description copied from interface:QueryExecute the query and get the results (as aMorphiaCursor<Key<T>>)
-
modify
@Deprecated public Modify<T> modify(UpdateOperations<T> operations)
Deprecated.Description copied from interface:QueryThis is only intended for migration of legacy uses of UpdateOperations
-
search
public Query<T> search(String search, String language)
Deprecated.Description copied from interface:QueryPerform a text search on the content of the fields indexed with a text index..
-
retrieveKnownFields
public Query<T> retrieveKnownFields()
Deprecated.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
-
search
public Query<T> search(String search)
Deprecated.Description copied from interface:QueryPerform a text search on the content of the fields indexed with a text index..
-
update
@Deprecated public Update<T> update(List<UpdateOperator> updates)
Deprecated.Description copied from interface:QueryCreates an update operation based on this query
-
update
public Update<T> update(UpdateOperator first, UpdateOperator... updates)
Deprecated.Description copied from interface:QueryCreates an update operation based on this query- Specified by:
updatein interfaceQuery<T>- Parameters:
first- the first and required update operatorupdates- lists the set of updates to apply- Returns:
- the update operation
- See Also:
Query.update(UpdateOptions, UpdateOperator...)
-
update
@Deprecated(since="2.0", forRemoval=true) public Update<T> update(UpdateOperations<T> operations)
Deprecated, for removal: This API element is subject to removal in a future version.
-
update
public UpdateResult update(UpdateOptions options, Stage... updates)
Deprecated.Description copied from interface:QueryCreates an update operation based on this query
-
update
public UpdateResult update(UpdateOptions options, UpdateOperator... updates)
Deprecated.Description copied from interface:QueryCreates an update operation based on this query
-
getFieldsObject
@Nullable @MorphiaInternal public Document getFieldsObject()
Deprecated.- Returns:
- the Mongo fields
Document.
Developer note.This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
getSort
@Nullable @MorphiaInternal public Document getSort()
Deprecated.- Returns:
- the Mongo sort
Document.
Developer note.This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
toDocument
@MorphiaInternal public Document toDocument()
Deprecated.Converts the query to a Document and updates for any discriminator values as my be necessary- Specified by:
toDocumentin interfaceCriteria- Specified by:
toDocumentin interfaceQuery<T>- Returns:
- the query
Developer note.This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
isValidatingNames
public boolean isValidatingNames()
Deprecated.- Returns:
- true if field names are being validated
-
setQueryObject
public void setQueryObject(Document query)
Deprecated.Sets query structure directly- Parameters:
query- the Document containing the query
-
getDatastore
protected Datastore getDatastore()
Deprecated.
-
-