public class ViewQuery extends Object implements Serializable
Fluent DSL for a View Query.
Modifier and Type | Method and Description |
---|---|
ViewQuery |
debug()
Enabled debugging on view queries.
|
ViewQuery |
debug(boolean debug) |
ViewQuery |
descending()
Return the documents in descending by key order.
|
ViewQuery |
descending(boolean desc) |
ViewQuery |
development() |
ViewQuery |
development(boolean development) |
protected String |
encode(String source)
Helper method to properly encode a string.
|
ViewQuery |
endKey(boolean key) |
ViewQuery |
endKey(double key) |
ViewQuery |
endKey(int key) |
ViewQuery |
endKey(JsonArray key) |
ViewQuery |
endKey(JsonObject key) |
ViewQuery |
endKey(long key) |
ViewQuery |
endKey(String key) |
ViewQuery |
endKeyDocId(String id) |
boolean |
equals(Object o) |
static ViewQuery |
from(String design,
String view)
Creates an new
ViewQuery . |
String |
getDesign() |
String |
getKeys() |
String |
getView() |
ViewQuery |
group()
Group the results using the reduce function to a group or single row.
|
ViewQuery |
group(boolean group) |
ViewQuery |
groupLevel(int grouplevel)
Specify the group level to be used.
|
int |
hashCode() |
ViewQuery |
includeDocs()
Proactively load the full document for the row returned.
|
ViewQuery |
includeDocs(boolean includeDocs)
Proactively load the full document for the row returned.
|
ViewQuery |
includeDocs(boolean includeDocs,
Class<? extends Document<?>> target)
Proactively load the full document for the row returned.
|
ViewQuery |
includeDocs(Class<? extends Document<?>> target)
Proactively load the full document for the row returned.
|
Class<? extends Document<?>> |
includeDocsTarget() |
ViewQuery |
inclusiveEnd()
Specifies whether the specified end key should be included in the result.
|
ViewQuery |
inclusiveEnd(boolean inclusive) |
boolean |
isDevelopment() |
boolean |
isIncludeDocs() |
ViewQuery |
key(boolean key) |
ViewQuery |
key(double key) |
ViewQuery |
key(int key) |
ViewQuery |
key(JsonArray key) |
ViewQuery |
key(JsonObject key) |
ViewQuery |
key(long key) |
ViewQuery |
key(String key) |
ViewQuery |
keys(JsonArray keys) |
ViewQuery |
limit(int limit)
Limit the number of the returned documents to the specified number.
|
ViewQuery |
onError(OnError onError)
Sets the response in the event of an error.
|
ViewQuery |
reduce() |
ViewQuery |
reduce(boolean reduce)
Explicitly enable/disable the reduce function on the query.
|
ViewQuery |
skip(int skip)
Skip this number of records before starting to return the results.
|
ViewQuery |
stale(Stale stale)
Allow the results from a stale view to be used.
|
ViewQuery |
startKey(boolean key) |
ViewQuery |
startKey(double key) |
ViewQuery |
startKey(int key) |
ViewQuery |
startKey(JsonArray key) |
ViewQuery |
startKey(JsonObject key) |
ViewQuery |
startKey(long key) |
ViewQuery |
startKey(String key) |
ViewQuery |
startKeyDocId(String id) |
String |
toString() |
public static ViewQuery from(String design, String view)
Creates an new ViewQuery
.
design
- the name of the design document.view
- the name of the view.ViewQuery
DSL.public ViewQuery development()
public ViewQuery development(boolean development)
public ViewQuery includeDocs()
Proactively load the full document for the row returned.
This only works if reduce is false, since with reduce the original document ID is not included anymore.
ViewQuery
DSL.public ViewQuery includeDocs(Class<? extends Document<?>> target)
Proactively load the full document for the row returned.
This only works if reduce is false, since with reduce the original document ID is not included anymore.
target
- the custom document type target.ViewQuery
DSL.public ViewQuery includeDocs(boolean includeDocs)
Proactively load the full document for the row returned.
This only works if reduce is false, since with reduce the original document ID is not included anymore.
includeDocs
- if it should be enabled or not.ViewQuery
DSL.public ViewQuery includeDocs(boolean includeDocs, Class<? extends Document<?>> target)
Proactively load the full document for the row returned.
This only works if reduce is false, since with reduce the original document ID is not included anymore.
includeDocs
- if it should be enabled or not.target
- the custom document type target.ViewQuery
DSL.public ViewQuery reduce(boolean reduce)
Explicitly enable/disable the reduce function on the query.
reduce
- if reduce should be enabled or not.ViewQuery
object for proper chaining.public ViewQuery reduce()
public ViewQuery limit(int limit)
Limit the number of the returned documents to the specified number.
limit
- the number of documents to return.ViewQuery
object for proper chaining.public ViewQuery group()
Group the results using the reduce function to a group or single row.
Important: this setter and groupLevel(int)
should not be used together in the same ViewQuery
. It is sufficient to only set the grouping level only and use this setter in cases where you always want the highest group level implictly.
ViewQuery
object for proper chaining.public ViewQuery group(boolean group)
public ViewQuery groupLevel(int grouplevel)
Specify the group level to be used.
Important: group()
and this setter should not be used together in the same ViewQuery
. It is sufficient to only use this setter and use group()
in cases where you always want the highest group level implictly.
grouplevel
- How deep the grouping level should be.ViewQuery
object for proper chaining.public ViewQuery inclusiveEnd()
Specifies whether the specified end key should be included in the result.
ViewQuery
object for proper chaining.public ViewQuery inclusiveEnd(boolean inclusive)
public ViewQuery skip(int skip)
Skip this number of records before starting to return the results.
skip
- The number of records to skip.ViewQuery
object for proper chaining.public ViewQuery stale(Stale stale)
Allow the results from a stale view to be used.
See the “Stale” enum for more information on the possible options. The default setting is “update_after”!
stale
- Which stale mode should be used.ViewQuery
object for proper chaining.public ViewQuery onError(OnError onError)
Sets the response in the event of an error.
See the “OnError” enum for more details on the available options.
onError
- The appropriate error handling type.ViewQuery
object for proper chaining.public ViewQuery debug()
Enabled debugging on view queries.
ViewQuery
object for proper chaining.public ViewQuery debug(boolean debug)
public ViewQuery descending()
Return the documents in descending by key order.
ViewQuery
object for proper chaining.public ViewQuery descending(boolean desc)
public ViewQuery key(int key)
public ViewQuery key(long key)
public ViewQuery key(double key)
public ViewQuery key(boolean key)
public ViewQuery key(JsonObject key)
public ViewQuery endKey(int key)
public ViewQuery endKey(long key)
public ViewQuery endKey(double key)
public ViewQuery endKey(boolean key)
public ViewQuery endKey(JsonObject key)
public ViewQuery startKey(int key)
public ViewQuery startKey(long key)
public ViewQuery startKey(double key)
public ViewQuery startKey(boolean key)
public ViewQuery startKey(JsonObject key)
protected String encode(String source)
Helper method to properly encode a string.
This method can be overridden if a different encoding logic needs to be used. If so, note that keys
is not encoded via this method, but by the core.
source
- source string.public String getDesign()
public String getView()
public boolean isDevelopment()
public boolean isIncludeDocs()
Copyright © 2014 Couchbase, Inc.