Interface ICouchbaseCollection
Represents a collection of JSON objects in Couchbase.
Namespace: Couchbase.KeyValue
Assembly: Couchbase.NetClient.dll
Syntax
public interface ICouchbaseCollection
Properties
| Improve this Doc View SourceBinary
A special collection for non-JSON operations; maps to binary operation in the older API's.
Declaration
IBinaryCollection Binary { get; }
Property Value
Type | Description |
---|---|
IBinaryCollection |
Cid
The identifier for the collection.
Declaration
uint? Cid { get; }
Property Value
Type | Description |
---|---|
Nullable<UInt32> |
IsDefaultCollection
Returns true if this is the default collection in the default scope.
Declaration
bool IsDefaultCollection { get; }
Property Value
Type | Description |
---|---|
Boolean |
Name
The name of the collection.
Declaration
string Name { get; }
Property Value
Type | Description |
---|---|
String |
QueryIndexes
Provides access to the indexes at the Collection level.
Declaration
ICollectionQueryIndexManager QueryIndexes { get; }
Property Value
Type | Description |
---|---|
ICollectionQueryIndexManager |
Scope
Scope which owns this collection.
Declaration
IScope Scope { get; }
Property Value
Type | Description |
---|---|
IScope |
Methods
| Improve this Doc View SourceExistsAsync(String, ExistsOptions)
Returns true if a document exists for a given id, otherwise false.
Declaration
Task<IExistsResult> ExistsAsync(string id, ExistsOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
String | id | The id of the document. |
ExistsOptions | options | Any optional parameters. |
Returns
Type | Description |
---|---|
Task<IExistsResult> | An asychronous |
GetAllReplicasAsync(String, GetAllReplicasOptions)
Gets a list of document data from the server, leveraging both the active and all available replicas.
Declaration
IEnumerable<Task<IGetReplicaResult>> GetAllReplicasAsync(string id, GetAllReplicasOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
String | id | The id of the document. |
GetAllReplicasOptions | options | Any optional parameters. |
Returns
Type | Description |
---|---|
IEnumerable<Task<IGetReplicaResult>> | An asychronous |
GetAndLockAsync(String, TimeSpan, GetAndLockOptions)
Gets a document for a given id and places a pessimistic lock on it for mutations.
Declaration
Task<IGetResult> GetAndLockAsync(string id, TimeSpan expiry, GetAndLockOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
String | id | The id of the document. |
TimeSpan | expiry | The duration of the lock. |
GetAndLockOptions | options | Any optional parameters. |
Returns
Type | Description |
---|---|
Task<IGetResult> | An asychronous |
Remarks
The maximum amount of time a key can be locked is 30 seconds; any parameter you provide that is more than 30 seconds will be set to 30 seconds; negative numbers will be interpreted as 30 seconds also.
GetAndTouchAsync(String, TimeSpan, GetAndTouchOptions)
Gets a document for a given id and extends its expiration.
Declaration
Task<IGetResult> GetAndTouchAsync(string id, TimeSpan expiry, GetAndTouchOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
String | id | The id of the document. |
TimeSpan | expiry | The duration of the lock. |
GetAndTouchOptions | options | Any optional parameters. |
Returns
Type | Description |
---|---|
Task<IGetResult> | An asychronous |
GetAnyReplicaAsync(String, GetAnyReplicaOptions)
Gets a document for a given id, leveraging both the active and all available replicas. This method follows the same semantics of GetAllReplicas (including the fetch from ACTIVE), but returns the first response as opposed to returning all responses.
Declaration
Task<IGetReplicaResult> GetAnyReplicaAsync(string id, GetAnyReplicaOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
String | id | The id of the document. |
GetAnyReplicaOptions | options | Any optional parameters. |
Returns
Type | Description |
---|---|
Task<IGetReplicaResult> | An asychronous |
GetAsync(String, GetOptions)
Fetches a value from the server if it exists.
Declaration
Task<IGetResult> GetAsync(string id, GetOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
String | id | The id of the document. |
GetOptions | options | Optional parameters. |
Returns
Type | Description |
---|---|
Task<IGetResult> | An asychronous |
InsertAsync<T>(String, T, InsertOptions)
Insert a JSON document, failing if it already exists. Maps to Memcached Add command.
Declaration
Task<IMutationResult> InsertAsync<T>(string id, T content, InsertOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
String | id | The id of the document. |
T | content | The content or document body. |
InsertOptions | options | Any optional parameters. |
Returns
Type | Description |
---|---|
Task<IMutationResult> | An asychronous |
Type Parameters
Name | Description |
---|---|
T | The |
LookupInAsync(String, IEnumerable<LookupInSpec>, LookupInOptions)
Allows the chaining of Sub-Document fetch operations like, Get("path") and Exists("path") into a single atomic fetch.
Declaration
Task<ILookupInResult> LookupInAsync(string id, IEnumerable<LookupInSpec> specs, LookupInOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
String | id | The id of the document. |
IEnumerable<LookupInSpec> | specs | An array of fetch operations - requires at least one: exists, get, count. There is a server enforced maximum of 16 sub document operations allowed per call. |
LookupInOptions | options | Any optional parameters. |
Returns
Type | Description |
---|---|
Task<ILookupInResult> | An asychronous |
MutateInAsync(String, IEnumerable<MutateInSpec>, MutateInOptions)
Allows the chaining of Sub-Document mutation operations on a specific document in a single atomic transaction.
Declaration
Task<IMutateInResult> MutateInAsync(string id, IEnumerable<MutateInSpec> specs, MutateInOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
String | id | The id of the document. |
IEnumerable<MutateInSpec> | specs | An array of fetch operations - requires at least one: exists, get, count. There is a server enforced maximum of 16 sub document operations allowed per call. |
MutateInOptions | options | Any optional parameters. |
Returns
Type | Description |
---|---|
Task<IMutateInResult> | An asychronous |
RemoveAsync(String, RemoveOptions)
Removes an existing document in Couchbase server, failing if it does not exist.
Declaration
Task RemoveAsync(string id, RemoveOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
String | id | The id of the document. |
RemoveOptions | options | Any optional parameters. |
Returns
Type | Description |
---|---|
Task | An asychronous |
ReplaceAsync<T>(String, T, ReplaceOptions)
Replaces an existing document in Couchbase server, failing if it does not exist. Maps to Memcached SET command.
Declaration
Task<IMutationResult> ReplaceAsync<T>(string id, T content, ReplaceOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
String | id | The id of the document. |
T | content | The content or document body. |
ReplaceOptions | options | Any optional parameters. |
Returns
Type | Description |
---|---|
Task<IMutationResult> | An asychronous |
Type Parameters
Name | Description |
---|---|
T | The |
ScanAsync(IScanType, ScanOptions)
Declaration
IAsyncEnumerable<IScanResult> ScanAsync(IScanType scanType, ScanOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
IScanType | scanType | |
ScanOptions | options |
Returns
Type | Description |
---|---|
IAsyncEnumerable<IScanResult> |
TouchAsync(String, TimeSpan, TouchOptions)
Updates the expiration a document given an id, without modifying or returning its value.
Declaration
Task TouchAsync(string id, TimeSpan expiry, TouchOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
String | id | The id of the document. |
TimeSpan | expiry | The |
TouchOptions | options | Any optional parameters. |
Returns
Type | Description |
---|---|
Task | An asychronous |
UnlockAsync(String, UInt64, UnlockOptions)
Unlocks a document pessimistically locked by a GetAndLock operation.
Declaration
Task UnlockAsync(string id, ulong cas, UnlockOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
String | id | The id of the document. |
UInt64 | cas | The CAS from the GetAndLock operation. |
UnlockOptions | options | Any optional parameters. |
Returns
Type | Description |
---|---|
Task | An asychronous |
UnlockAsync<T>(String, UInt64, UnlockOptions)
Declaration
Task UnlockAsync<T>(string id, ulong cas, UnlockOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
String | id | |
UInt64 | cas | |
UnlockOptions | options |
Returns
Type | Description |
---|---|
Task |
Type Parameters
Name | Description |
---|---|
T |
UpsertAsync<T>(String, T, UpsertOptions)
Insert a new document or overwrite an existing document in Couchbase server. Maps to Memcached Set command.
Declaration
Task<IMutationResult> UpsertAsync<T>(string id, T content, UpsertOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
String | id | The id of the document. |
T | content | The content or document body. |
UpsertOptions | options | Any optional parameters. |
Returns
Type | Description |
---|---|
Task<IMutationResult> | An asychronous |
Type Parameters
Name | Description |
---|---|
T | The |