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 protected
LegacyQuery(Datastore datastore, String collectionName, Class<T> type)
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 void
add(Criteria... criteria)
Deprecated.Adds Criteria to this containerCriteriaContainer
and(Criteria... criteria)
Deprecated.Ands Criteria with this CriteriaContainer.void
attach(CriteriaContainer container)
Deprecated.Used to add this Criteria to a CriteriaContainerlong
count()
Deprecated.Count the total number of values in the result, ignoring limit and offsetlong
count(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 fieldDeleteResult
delete(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 onboolean
equals(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(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.T
findAndDelete(FindAndDeleteOptions options)
Deprecated.Deletes an entity from the database and returns it.T
first()
Deprecated.Gets the first entity in the result set.T
first(FindOptions options)
Deprecated.Gets the first entity in the result set.protected Datastore
getDatastore()
Deprecated.Class<T>
getEntityClass()
Deprecated.String
getFieldName()
Deprecated.Document
getFieldsObject()
Deprecated.String
getLoggedQuery()
Deprecated.Document
getSort()
Deprecated.int
hashCode()
Deprecated.void
invalid(ValidationException e)
Deprecated.boolean
isValidate()
Deprecated.boolean
isValidatingNames()
Deprecated.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>>
)T
modify(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 queryCriteriaContainer
or(Criteria... criteria)
Deprecated.Ors Criteria with this CriteriaContainer.void
remove(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..void
setQueryObject(Document query)
Deprecated.Sets query structure directlyDocument
toDocument()
Deprecated.Converts the query to a Document and updates for any discriminator values as my be necessaryString
toString()
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 queryUpdateResult
update(UpdateOptions options, Stage... updates)
Deprecated.Creates an update operation based on this queryUpdateResult
update(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:CriteriaContainer
Adds Criteria to this container- Specified by:
add
in interfaceCriteriaContainer
- Parameters:
criteria
- the criteria to add
-
and
public CriteriaContainer and(Criteria... criteria)
Deprecated.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
-
criteria
public FieldEnd<? extends CriteriaContainer> criteria(String field)
Deprecated.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
-
invalid
@MorphiaInternal public void invalid(ValidationException e)
Deprecated.
-
or
public CriteriaContainer or(Criteria... criteria)
Deprecated.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
-
remove
public void remove(Criteria criteria)
Deprecated.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)
Deprecated.Description copied from interface:Criteria
Used to add this Criteria to a CriteriaContainer
-
getFieldName
public String getFieldName()
Deprecated.- Specified by:
getFieldName
in interfaceCriteria
- Returns:
- the field name for the criteria
-
count
public long count(CountOptions options)
Deprecated.Description copied from interface:Query
Count the total number of values in the result, ignoring limit and offset
-
count
public long count()
Deprecated.Description copied from interface:Query
Count 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:
execute
in interfaceQuery<T>
- Returns:
- a MorphiaCursor
- See Also:
iterator(FindOptions)
-
delete
public DeleteResult delete(DeleteOptions options)
Deprecated.Description copied from interface:Query
Deletes documents matching this query. Optionally deleting the first or all matched documents.
-
explain
public Map<String,Object> explain(FindOptions options, @Nullable ExplainVerbosity verbosity)
Deprecated.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.
-
disableValidation
public Query<T> disableValidation()
Deprecated.Description copied from interface:Query
Turns off validation (for all calls made after)- Specified by:
disableValidation
in interfaceQuery<T>
- Returns:
- this
-
enableValidation
public Query<T> enableValidation()
Deprecated.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
-
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:
getLoggedQuery
in 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:Query
Fluent query interface:createQuery(Ent.class).field("count").greaterThan(7)...
-
filter
public Query<T> filter(String condition, Object value)
Deprecated.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
.
-
findAndDelete
public T findAndDelete(FindAndDeleteOptions options)
Deprecated.Description copied from interface:Query
Deletes an entity from the database and returns it.- Specified by:
findAndDelete
in interfaceQuery<T>
- Parameters:
options
- the options to apply- Returns:
- the deleted entity
-
getEntityClass
@MorphiaInternal public Class<T> getEntityClass()
Deprecated.- Specified by:
getEntityClass
in 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:Query
Gets the first entity in the result set. Obeys theQuery
offset value.
-
first
public T first(FindOptions options)
Deprecated.Description copied from interface:Query
Gets the first entity in the result set. Obeys theQuery
offset value.
-
modify
public Modify<T> modify(UpdateOperator first, UpdateOperator... updates)
Deprecated.Description copied from interface:Query
Create a modify operation based on this query
-
modify
public T modify(ModifyOptions options, UpdateOperator... updates)
Deprecated.Description copied from interface:Query
Create a modify operation based on this query
-
isValidate
@MorphiaInternal public boolean isValidate()
Deprecated.
-
iterator
public dev.morphia.query.internal.MorphiaCursor<T> iterator(FindOptions options)
Deprecated.Description copied from interface:Query
Execute the query and get the results.
-
keys
public dev.morphia.query.internal.MorphiaKeyCursor<T> keys(FindOptions options)
Deprecated.Description copied from interface:Query
Execute the query and get the results (as aMorphiaCursor<Key<T>>
)
-
keys
public dev.morphia.query.internal.MorphiaKeyCursor<T> keys()
Deprecated.Description copied from interface:Query
Execute the query and get the results (as aMorphiaCursor<Key<T>>
)
-
modify
@Deprecated public Modify<T> modify(UpdateOperations<T> operations)
Deprecated.Description copied from interface:Query
This is only intended for migration of legacy uses of UpdateOperations
-
search
public Query<T> search(String search, String language)
Deprecated.Description copied from interface:Query
Perform a text search on the content of the fields indexed with a text index..
-
retrieveKnownFields
public Query<T> retrieveKnownFields()
Deprecated.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
-
search
public Query<T> search(String search)
Deprecated.Description copied from interface:Query
Perform 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:Query
Creates an update operation based on this query
-
update
public Update<T> update(UpdateOperator first, UpdateOperator... updates)
Deprecated.Description copied from interface:Query
Creates an update operation based on this query- Specified by:
update
in 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:Query
Creates an update operation based on this query
-
update
public UpdateResult update(UpdateOptions options, UpdateOperator... updates)
Deprecated.Description copied from interface:Query
Creates 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:
toDocument
in interfaceCriteria
- Specified by:
toDocument
in 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.
-
-