Package com.couchbase.client.java
Class AsyncScope
- java.lang.Object
-
- com.couchbase.client.java.AsyncScope
-
public class AsyncScope extends Object
The scope identifies a group of collections and allows high application density as a result.If no scope is explicitly provided, the default scope is used.
- Since:
- 3.0.0
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletableFuture<AnalyticsResult>
analyticsQuery(String statement)
Performs an Analytics query with defaultAnalyticsOptions
.CompletableFuture<AnalyticsResult>
analyticsQuery(String statement, AnalyticsOptions options)
Performs an Analytics query with customAnalyticsOptions
.String
bucketName()
The name of the bucket this scope is attached to.AsyncCollection
collection(String collectionName)
Opens a collection for this scope with an explicit name.Core
core()
Provides access to the underlyingCore
.ClusterEnvironment
environment()
Provides access to the configuredClusterEnvironment
for this scope.String
name()
The name of the scope.CompletableFuture<QueryResult>
query(String statement)
Performs a N1QL query with defaultQueryOptions
in a ScopeCompletableFuture<QueryResult>
query(String statement, QueryOptions options)
Performs a N1QL query with customQueryOptions
in a Scope.AsyncScopeSearchIndexManager
searchIndexes()
Allows managed scope FTS indexes.CompletableFuture<SearchResult>
searchQuery(String indexName, SearchQuery query)
Performs a Full Text Search (FTS) query with defaultSearchOptions
.CompletableFuture<SearchResult>
searchQuery(String indexName, SearchQuery query, SearchOptions options)
Performs a Full Text Search (FTS) query with customSearchOptions
.
-
-
-
Method Detail
-
name
public String name()
The name of the scope.
-
bucketName
public String bucketName()
The name of the bucket this scope is attached to.
-
core
@Volatile public Core core()
Provides access to the underlyingCore
.This is advanced API, use with care!
-
environment
public ClusterEnvironment environment()
Provides access to the configuredClusterEnvironment
for this scope.
-
collection
public AsyncCollection collection(String collectionName)
Opens a collection for this scope with an explicit name.- Parameters:
collectionName
- the collection name.- Returns:
- the requested collection if successful.
-
query
public CompletableFuture<QueryResult> query(String statement)
Performs a N1QL query with defaultQueryOptions
in a Scope- Parameters:
statement
- the N1QL query statement.- Returns:
- the
QueryResult
once the response arrives successfully. - Throws:
TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
query
public CompletableFuture<QueryResult> query(String statement, QueryOptions options)
Performs a N1QL query with customQueryOptions
in a Scope.- Parameters:
statement
- the N1QL query statement as a raw string.options
- the custom options for this query.- Returns:
- the
QueryResult
once the response arrives successfully.
-
analyticsQuery
public CompletableFuture<AnalyticsResult> analyticsQuery(String statement)
Performs an Analytics query with defaultAnalyticsOptions
.- Parameters:
statement
- the Analytics query statement as a raw string.- Returns:
- the
AnalyticsResult
once the response arrives successfully.
-
analyticsQuery
public CompletableFuture<AnalyticsResult> analyticsQuery(String statement, AnalyticsOptions options)
Performs an Analytics query with customAnalyticsOptions
.- Parameters:
statement
- the Analytics query statement as a raw string.options
- the custom options for this analytics query.- Returns:
- the
AnalyticsResult
once the response arrives successfully.
-
searchQuery
public CompletableFuture<SearchResult> searchQuery(String indexName, SearchQuery query)
Performs a Full Text Search (FTS) query with defaultSearchOptions
.- Parameters:
query
- the query, in the form of aSearchQuery
- Returns:
- the
SearchRequest
once the response arrives successfully, inside aCompletableFuture
-
searchQuery
@Volatile public CompletableFuture<SearchResult> searchQuery(String indexName, SearchQuery query, SearchOptions options)
Performs a Full Text Search (FTS) query with customSearchOptions
.- Parameters:
query
- the query, in the form of aSearchQuery
options
- the custom options for this query.- Returns:
- the
SearchRequest
once the response arrives successfully, inside aCompletableFuture
-
searchIndexes
@Volatile public AsyncScopeSearchIndexManager searchIndexes()
Allows managed scope FTS indexes.
-
-