public class DaoQuery extends AbstractQueryCriterion<DaoQuery>
| Modifier and Type | Class and Description |
|---|---|
static interface |
DaoQuery.CursorVisitor
Allows for the visiting of the
DBCursor
before it is returned as an ObjectIterator
form the various query methods of this class. |
criteria, propertyStack| Modifier and Type | Method and Description |
|---|---|
DaoQuery |
addSort(java.lang.String name,
java.lang.Integer direction)
Adds a sort.
|
DaoQuery |
addSpecial(java.lang.String name,
java.lang.Object special)
Adds a special.
|
void |
assertValid()
Asserts that the
DaoQuery is valid. |
void |
clear()
Clears the query.
|
long |
countObjects()
Executes the query and returns the number of objects
that it would return.
|
java.util.List<java.lang.Object> |
distinct(java.lang.String field)
Returns distinct values for the given field.
|
<T> java.util.List<T> |
distinct(java.lang.String field,
java.lang.Class<T> expected)
Returns distinct values for the given field.
|
com.mongodb.DBObject |
explain()
Explains the current query.
|
com.mongodb.DBObject |
findObject()
Executes the query and returns objects of the given type.
|
<T> T |
findObject(java.lang.Class<T> clazz)
Executes the query and returns an object of the given type.
|
com.mongodb.DBObject |
findObject(com.mongodb.DBObject fields)
Executes the query and returns objects of the given type.
|
com.mongodb.DBCursor |
findObjects()
Executes the query and returns objects of the given type.
|
<T> ObjectIterator<T> |
findObjects(java.lang.Class<T> clazz)
Executes the query and returns objects of the given type.
|
com.mongodb.DBCursor |
findObjects(com.mongodb.DBObject fields)
Executes the query and returns objects of the given type.
|
com.mongodb.DBCursor |
findObjects(java.lang.String... fields)
Executes the query and returns objects of the given type.
|
java.lang.String |
getCollection()
Returns the collection that this query is for.
|
com.mongodb.DB |
getDB()
Returns the
MongoDao that created this query. |
ObjectMapper |
getObjectMapper()
Returns the
ObjectMapper. |
com.mongodb.DBObject |
getSortDBObject()
Creates and returns the DBObject representing
the sort for this query.
|
DaoModifier |
modify()
Creates a
DaoModifier for the
current query. |
protected DaoQuery |
self() |
DaoQuery |
setBatchSize(java.lang.Integer batchSize) |
DaoQuery |
setCollection(java.lang.String collection) |
DaoQuery |
setComment(java.lang.String comment) |
DaoQuery |
setCursorVisitor(DaoQuery.CursorVisitor cursorVisitor) |
DaoQuery |
setDB(com.mongodb.DB db) |
DaoQuery |
setFirstDocument(java.lang.Integer firstDocument) |
DaoQuery |
setHint(com.mongodb.DBObject hint) |
DaoQuery |
setHint(java.lang.String hint,
int dir) |
DaoQuery |
setMaxDocuments(java.lang.Integer maxDocuments) |
DaoQuery |
setObjectMapper(ObjectMapper objectMapper) |
DaoQuery |
setReadPreference(com.mongodb.ReadPreference readPreference) |
DaoQuery |
setSnapShot() |
DaoQuery |
setSnapShot(java.lang.Boolean snapShot) |
DaoQuery |
setSort(com.mongodb.DBObject sort) |
DaoQuery |
setSort(java.util.Map<java.lang.String,java.lang.Integer> sort) |
void |
setSpecials(java.util.Map<java.lang.String,java.lang.Object> specials) |
all, all, and, and, and, between, elemMatch, eq, exists, gt, gte, in, in, lt, lte, mod, ne, near, near, nin, nin, nor, nor, nor, not, not, or, or, or, regex, regex, regex, size, type, type, within, within, withinadd, add, pop, push, toQueryObjectpublic DaoQuery()
DaoQuery.public void clear()
clear in class AbstractCriterionBuilder<DaoQuery>public void assertValid()
DaoQuery is valid.
Throws an exception if not.public DaoModifier modify()
DaoModifier for the
current query.DaoModifierpublic <T> ObjectIterator<T> findObjects(java.lang.Class<T> clazz)
clazz - the type of objects to returnpublic com.mongodb.DBCursor findObjects(com.mongodb.DBObject fields)
fields - the fields to returnpublic com.mongodb.DBCursor findObjects()
clazz - the type of objects to returnpublic com.mongodb.DBCursor findObjects(java.lang.String... fields)
fields - the type of objects to returnpublic <T> T findObject(java.lang.Class<T> clazz)
clazz - the type of object to returnpublic com.mongodb.DBObject findObject(com.mongodb.DBObject fields)
clazz - the type of objects to returnpublic com.mongodb.DBObject findObject()
clazz - the type of objects to returnpublic long countObjects()
public java.util.List<java.lang.Object> distinct(java.lang.String field)
field - the fieldpublic <T> java.util.List<T> distinct(java.lang.String field,
java.lang.Class<T> expected)
field - the fieldexpected - the expected typepublic com.mongodb.DBObject explain()
public com.mongodb.DBObject getSortDBObject()
protected DaoQuery self()
self in class AbstractCriterionBuilder<DaoQuery>public DaoQuery addSort(java.lang.String name, java.lang.Integer direction)
name - the fielddirection - the directionpublic DaoQuery addSpecial(java.lang.String name, java.lang.Object special)
name - the namespecial - the specialpublic DaoQuery setSort(java.util.Map<java.lang.String,java.lang.Integer> sort)
sort - the sort to setpublic DaoQuery setSort(com.mongodb.DBObject sort)
sort - the sort to setpublic void setSpecials(java.util.Map<java.lang.String,java.lang.Object> specials)
specials - the specials to setpublic DaoQuery setFirstDocument(java.lang.Integer firstDocument)
firstDocument - the firstDocument to setpublic DaoQuery setMaxDocuments(java.lang.Integer maxDocuments)
maxDocuments - the maxDocuments to setpublic DaoQuery setBatchSize(java.lang.Integer batchSize)
batchSize - the batchSize to setpublic DaoQuery setHint(java.lang.String hint, int dir)
hint - the hint to setpublic DaoQuery setHint(com.mongodb.DBObject hint)
hint - the hint to setpublic DaoQuery setSnapShot(java.lang.Boolean snapShot)
snapShot - the snapShot to setpublic DaoQuery setSnapShot()
snapShot - the snapShot to setpublic DaoQuery setComment(java.lang.String comment)
comment - the comment to setpublic DaoQuery setCollection(java.lang.String collection)
collection - the collection to setpublic DaoQuery setDB(com.mongodb.DB db)
mongoDao - the mongoDao to setpublic DaoQuery setCursorVisitor(DaoQuery.CursorVisitor cursorVisitor)
cursorVisitor - the cursorVisitor to setpublic DaoQuery setObjectMapper(ObjectMapper objectMapper)
objectMapper - the objectMapper to setpublic DaoQuery setReadPreference(com.mongodb.ReadPreference readPreference)
readPreference - the readPreference to setpublic java.lang.String getCollection()
public com.mongodb.DB getDB()
MongoDao that created this query.public ObjectMapper getObjectMapper()
ObjectMapper.Copyright © 2013. All Rights Reserved.