Class CollectionExtensions
Namespace: Couchbase.KeyValue
Assembly: Couchbase.NetClient.dll
Syntax
public static class CollectionExtensions : object
Methods
| Improve this Doc View SourceDictionary<TValue>(ICouchbaseCollection, String)
Get an IPersistentDictionary<TValue> backed by a given document.
Declaration
public static IPersistentDictionary<TValue> Dictionary<TValue>(this ICouchbaseCollection collection, string docId)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
String | docId | Document ID which backs the dictionary. |
Returns
Type | Description |
---|---|
IPersistentDictionary<TValue> | The persistent dictionary. |
Type Parameters
Name | Description |
---|---|
TValue |
Remarks
If using a SystemTextJsonSerializer backed by a IDictionary<string, TValue>
in a
ExistsAsync(ICouchbaseCollection, String)
Returns true if a document exists for a given id, otherwise false.
Declaration
public static Task<IExistsResult> ExistsAsync(this ICouchbaseCollection collection, string id)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
String | id | The id of the document. |
Returns
Type | Description |
---|---|
Task<IExistsResult> | An asychronous |
ExistsAsync(ICouchbaseCollection, String, Action<ExistsOptions>)
Returns true if a document exists for a given id, otherwise false.
Declaration
public static Task<IExistsResult> ExistsAsync(this ICouchbaseCollection collection, string id, Action<ExistsOptions> configureOptions)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
String | id | The id of the document. |
Action<ExistsOptions> | configureOptions | Optional parameters |
Returns
Type | Description |
---|---|
Task<IExistsResult> | An asychronous |
GetAllReplicasAsync(ICouchbaseCollection, String)
Gets a list of document data from the server, leveraging both the active and all available replicas.
Declaration
public static IEnumerable<Task<IGetReplicaResult>> GetAllReplicasAsync(this ICouchbaseCollection collection, string id)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
String | id | The id of the document. |
Returns
Type | Description |
---|---|
IEnumerable<Task<IGetReplicaResult>> | An asychronous |
GetAllReplicasAsync(ICouchbaseCollection, String, Action<GetAllReplicasOptions>)
Gets a list of document data from the server, leveraging both the active and all available replicas.
Declaration
public static IEnumerable<Task<IGetReplicaResult>> GetAllReplicasAsync(this ICouchbaseCollection collection, string id, Action<GetAllReplicasOptions> configureOptions)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
String | id | The id of the document. |
Action<GetAllReplicasOptions> | configureOptions | Optional parameters |
Returns
Type | Description |
---|---|
IEnumerable<Task<IGetReplicaResult>> | An asychronous |
GetAndLockAsync(ICouchbaseCollection, String, TimeSpan)
Gets a document for a given id and places a pessimistic lock on it for mutations.
Declaration
public static Task<IGetResult> GetAndLockAsync(this ICouchbaseCollection collection, string id, TimeSpan expiry)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
String | id | The id of the document. |
TimeSpan | expiry | The duration of the lock. |
Returns
Type | Description |
---|---|
Task<IGetResult> | An asychronous |
GetAndLockAsync(ICouchbaseCollection, String, TimeSpan, Action<GetAndLockOptions>)
Gets a document for a given id and places a pessimistic lock on it for mutations.
Declaration
public static Task<IGetResult> GetAndLockAsync(this ICouchbaseCollection collection, string id, TimeSpan expiry, Action<GetAndLockOptions> configureOptions)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
String | id | The id of the document. |
TimeSpan | expiry | The |
Action<GetAndLockOptions> | configureOptions | Any optional parameters. |
Returns
Type | Description |
---|---|
Task<IGetResult> | An asychronous |
GetAndTouchAsync(ICouchbaseCollection, String, TimeSpan)
Gets a document for a given id and extends its expiration.
Declaration
public static Task<IGetResult> GetAndTouchAsync(this ICouchbaseCollection collection, string id, TimeSpan expiry)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
String | id | The id of the document. |
TimeSpan | expiry | The |
Returns
Type | Description |
---|---|
Task<IGetResult> | An asychronous |
GetAndTouchAsync(ICouchbaseCollection, String, TimeSpan, Action<GetAndTouchOptions>)
Gets a document for a given id and extends its expiration.
Declaration
public static Task<IGetResult> GetAndTouchAsync(this ICouchbaseCollection collection, string id, TimeSpan expiry, Action<GetAndTouchOptions> configureOptions)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
String | id | The id of the document. |
TimeSpan | expiry | The |
Action<GetAndTouchOptions> | configureOptions | Any optional parameters. |
Returns
Type | Description |
---|---|
Task<IGetResult> | An asychronous |
GetAnyReplicaAsync(ICouchbaseCollection, String)
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
public static Task<IGetReplicaResult> GetAnyReplicaAsync(this ICouchbaseCollection collection, string id)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
String | id | The id of the document. |
Returns
Type | Description |
---|---|
Task<IGetReplicaResult> | An asychronous |
GetAnyReplicaAsync(ICouchbaseCollection, String, Action<GetAnyReplicaOptions>)
Gets a list of document data from the server, leveraging both the active and all available replicas.
Declaration
public static Task<IGetReplicaResult> GetAnyReplicaAsync(this ICouchbaseCollection collection, string id, Action<GetAnyReplicaOptions> configureOptions)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
String | id | The id of the document. |
Action<GetAnyReplicaOptions> | configureOptions | Optional parameters |
Returns
Type | Description |
---|---|
Task<IGetReplicaResult> | An asychronous |
GetAsync(ICouchbaseCollection, String)
Fetches a value from the server if it exists.
Declaration
public static Task<IGetResult> GetAsync(this ICouchbaseCollection collection, string id)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
String | id | Primary key as a string. |
Returns
Type | Description |
---|---|
Task<IGetResult> | An asychronous |
GetAsync(ICouchbaseCollection, String, Action<GetOptions>)
Fetches a value from the server if it exists.
Declaration
public static Task<IGetResult> GetAsync(this ICouchbaseCollection collection, string id, Action<GetOptions> configureOptions)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
String | id | Primary key as a string. |
Action<GetOptions> | configureOptions | Optional parameters. |
Returns
Type | Description |
---|---|
Task<IGetResult> | An asychronous |
InsertAsync<T>(ICouchbaseCollection, String, T)
Insert a JSON document, failing if it already exists. Maps to Memcached Add command.
Declaration
public static Task<IMutationResult> InsertAsync<T>(this ICouchbaseCollection collection, string id, T content)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
String | id | The id of the document. |
T | content | The content or document body. |
Returns
Type | Description |
---|---|
Task<IMutationResult> | An asychronous |
Type Parameters
Name | Description |
---|---|
T | The |
InsertAsync<T>(ICouchbaseCollection, String, T, Action<InsertOptions>)
Insert a JSON document, failing if it already exists. Maps to Memcached Add command.
Declaration
public static Task<IMutationResult> InsertAsync<T>(this ICouchbaseCollection collection, string id, T content, Action<InsertOptions> optionsAction)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
String | id | The id of the document. |
T | content | The content or document body. |
Action<InsertOptions> | optionsAction | Any optional parameters. |
Returns
Type | Description |
---|---|
Task<IMutationResult> | An asychronous |
Type Parameters
Name | Description |
---|---|
T | The |
List<T>(ICouchbaseCollection, String)
Get an IPersistentList<T> backed by a given document.
Declaration
public static IPersistentList<T> List<T>(this ICouchbaseCollection collection, string docId)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
String | docId | Document ID which backs the list. |
Returns
Type | Description |
---|---|
IPersistentList<T> | The persistent list. |
Type Parameters
Name | Description |
---|---|
T |
Remarks
If using a SystemTextJsonSerializer backed by a
LookupInAsync(ICouchbaseCollection, String, Action<LookupInSpecBuilder>)
Allows the chaining of Sub-Document fetch operations like, Get("path") and Exists("path") into a single atomic fetch.
Declaration
public static Task<ILookupInResult> LookupInAsync(this ICouchbaseCollection collection, string id, Action<LookupInSpecBuilder> configureBuilder)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
String | id | The id of the document. |
Action<LookupInSpecBuilder> | configureBuilder | The builder for chaining sub doc operations - requires at least one: exists, get, count. There is a server enforced maximum of 16 sub document operations allowed per call. |
Returns
Type | Description |
---|---|
Task<ILookupInResult> | An asychronous |
LookupInAsync(ICouchbaseCollection, String, Action<LookupInSpecBuilder>, Action<LookupInOptions>)
Allows the chaining of Sub-Document fetch operations like, Get("path") and Exists("path") into a single atomic fetch.
Declaration
public static Task<ILookupInResult> LookupInAsync(this ICouchbaseCollection collection, string id, Action<LookupInSpecBuilder> configureBuilder, Action<LookupInOptions> configureOptions)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
String | id | The id of the document. |
Action<LookupInSpecBuilder> | configureBuilder | The builder for chaining sub doc operations - requires at least one: exists, get, count. There is a server enforced maximum of 16 sub document operations allowed per call. |
Action<LookupInOptions> | configureOptions | Any optional parameters. |
Returns
Type | Description |
---|---|
Task<ILookupInResult> | An asychronous |
LookupInAsync(ICouchbaseCollection, String, Action<LookupInSpecBuilder>, LookupInOptions)
Allows the chaining of Sub-Document fetch operations like, Get("path") and Exists("path") into a single atomic fetch.
Declaration
public static Task<ILookupInResult> LookupInAsync(this ICouchbaseCollection collection, string id, Action<LookupInSpecBuilder> configureBuilder, LookupInOptions options)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
String | id | The id of the document. |
Action<LookupInSpecBuilder> | configureBuilder | The builder for chaining sub doc 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 |
LookupInAsync(ICouchbaseCollection, String, IEnumerable<LookupInSpec>)
Allows the chaining of Sub-Document fetch operations like, Get("path") and Exists("path") into a single atomic fetch.
Declaration
public static Task<ILookupInResult> LookupInAsync(this ICouchbaseCollection collection, string id, IEnumerable<LookupInSpec> specs)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
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. |
Returns
Type | Description |
---|---|
Task<ILookupInResult> | An asychronous |
LookupInAsync(ICouchbaseCollection, String, IEnumerable<LookupInSpec>, Action<LookupInOptions>)
Allows the chaining of Sub-Document fetch operations like, Get("path") and Exists("path") into a single atomic fetch.
Declaration
public static Task<ILookupInResult> LookupInAsync(this ICouchbaseCollection collection, string id, IEnumerable<LookupInSpec> specs, Action<LookupInOptions> configureOptions)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
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. |
Action<LookupInOptions> | configureOptions | Any optional parameters. |
Returns
Type | Description |
---|---|
Task<ILookupInResult> | An asychronous |
LookupInAsync<TDocument>(ICouchbaseCollection, String, Action<LookupInSpecBuilder<TDocument>>, Action<LookupInOptions>)
Allows the chaining of Sub-Document fetch operations like, Get("path") and Exists("path") into a single atomic fetch. The result is strongly typed.
Declaration
public static Task<ILookupInResult<TDocument>> LookupInAsync<TDocument>(this ICouchbaseCollection collection, string id, Action<LookupInSpecBuilder<TDocument>> configureBuilder, Action<LookupInOptions> configureOptions)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
String | id | The id of the document. |
Action<LookupInSpecBuilder<TDocument>> | configureBuilder | An array of fetch operations - requires at least one: exists, get, count. |
Action<LookupInOptions> | configureOptions | Any optional parameters. |
Returns
Type | Description |
---|---|
Task<ILookupInResult<TDocument>> | An asychronous |
Type Parameters
Name | Description |
---|---|
TDocument | The document |
LookupInAsync<TDocument>(ICouchbaseCollection, String, Action<LookupInSpecBuilder<TDocument>>, LookupInOptions)
Allows the chaining of Sub-Document fetch operations like, Get("path") and Exists("path") into a single atomic fetch. The result is strongly typed.
Declaration
public static async Task<ILookupInResult<TDocument>> LookupInAsync<TDocument>(this ICouchbaseCollection collection, string id, Action<LookupInSpecBuilder<TDocument>> configureBuilder, LookupInOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
String | id | The id of the document. |
Action<LookupInSpecBuilder<TDocument>> | configureBuilder | An array of fetch operations - requires at least one: exists, get, count. |
LookupInOptions | options | Any optional parameters. |
Returns
Type | Description |
---|---|
Task<ILookupInResult<TDocument>> | An asychronous |
Type Parameters
Name | Description |
---|---|
TDocument | The document |
MutateInAsync(ICouchbaseCollection, String, Action<MutateInSpecBuilder>)
Allows the chaining of Sub-Document mutation operations on a specific document in a single atomic transaction.
Declaration
public static Task<IMutateInResult> MutateInAsync(this ICouchbaseCollection collection, string id, Action<MutateInSpecBuilder> configureBuilder)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
String | id | The id of the document. |
Action<MutateInSpecBuilder> | configureBuilder | An array of mutation Sub-Document operations: Iinsert, Upsert, Replace, Remove, ArrayPrepend, ArrayAppend, ArrayInsert, ArrayAddUnique, Increment and/or Decrement. |
Returns
Type | Description |
---|---|
Task<IMutateInResult> | An asychronous |
MutateInAsync(ICouchbaseCollection, String, Action<MutateInSpecBuilder>, Action<MutateInOptions>)
Allows the chaining of Sub-Document mutation operations on a specific document in a single atomic transaction.
Declaration
public static Task<IMutateInResult> MutateInAsync(this ICouchbaseCollection collection, string id, Action<MutateInSpecBuilder> configureBuilder, Action<MutateInOptions> configureOptions)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
String | id | The id of the document. |
Action<MutateInSpecBuilder> | configureBuilder | An array of mutation Sub-Document operations: Insert, Upsert, Replace, Remove, ArrayPrepend, ArrayAppend, ArrayInsert, ArrayAddUnique, Increment and/or Decrement. |
Action<MutateInOptions> | configureOptions | Any optional parameters. |
Returns
Type | Description |
---|---|
Task<IMutateInResult> | An asychronous |
MutateInAsync(ICouchbaseCollection, String, Action<MutateInSpecBuilder>, MutateInOptions)
Allows the chaining of Sub-Document mutation operations on a specific document in a single atomic transaction.
Declaration
public static Task<IMutateInResult> MutateInAsync(this ICouchbaseCollection collection, string id, Action<MutateInSpecBuilder> configureBuilder, MutateInOptions options)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
String | id | The id of the document. |
Action<MutateInSpecBuilder> | configureBuilder | An array of mutation Sub-Document operations: Insert, Upsert, Replace, Remove, ArrayPrepend, ArrayAppend, ArrayInsert, ArrayAddUnique, Increment and/or Decrement. |
MutateInOptions | options | Any optional parameters. |
Returns
Type | Description |
---|---|
Task<IMutateInResult> | An asychronous |
MutateInAsync(ICouchbaseCollection, String, IEnumerable<MutateInSpec>)
Allows the chaining of Sub-Document mutation operations on a specific document in a single atomic transaction.
Declaration
public static Task<IMutateInResult> MutateInAsync(this ICouchbaseCollection collection, string id, IEnumerable<MutateInSpec> specs)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
String | id | The id of the document. |
IEnumerable<MutateInSpec> | specs | An array of mutation Sub-Document operations: Insert, Upsert, Replace, Remove, ArrayPrepend, ArrayAppend, ArrayInsert, ArrayAddUnique, Increment and/or Decrement. |
Returns
Type | Description |
---|---|
Task<IMutateInResult> | An asychronous |
MutateInAsync(ICouchbaseCollection, String, IEnumerable<MutateInSpec>, Action<MutateInOptions>)
Allows the chaining of Sub-Document mutation operations on a specific document in a single atomic transaction.
Declaration
public static Task<IMutateInResult> MutateInAsync(this ICouchbaseCollection collection, string id, IEnumerable<MutateInSpec> specs, Action<MutateInOptions> configureOptions)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
String | id | The id of the document. |
IEnumerable<MutateInSpec> | specs | An array of mutation Sub-Document operations: Insert, Upsert, Replace, Remove, ArrayPrepend, ArrayAppend, ArrayInsert, ArrayAddUnique, Increment and/or Decrement. |
Action<MutateInOptions> | configureOptions | Any optional parameters. |
Returns
Type | Description |
---|---|
Task<IMutateInResult> | An asychronous |
MutateInAsync<TDocument>(ICouchbaseCollection, String, Action<MutateInSpecBuilder<TDocument>>, Action<MutateInOptions>)
Allows the chaining of Sub-Document fetch operations like, Get("path") and Exists("path") into a single atomic fetch. The result is strongly typed.
Declaration
public static Task<IMutateInResult<TDocument>> MutateInAsync<TDocument>(this ICouchbaseCollection collection, string id, Action<MutateInSpecBuilder<TDocument>> configureBuilder, Action<MutateInOptions> configureOptions)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
String | id | The id of the document. |
Action<MutateInSpecBuilder<TDocument>> | configureBuilder | An array of fetch operations - requires at least one: exists, get, count. |
Action<MutateInOptions> | configureOptions | Any optional parameters. |
Returns
Type | Description |
---|---|
Task<IMutateInResult<TDocument>> | An asychronous |
Type Parameters
Name | Description |
---|---|
TDocument | The document |
MutateInAsync<TDocument>(ICouchbaseCollection, String, Action<MutateInSpecBuilder<TDocument>>, MutateInOptions)
Allows the chaining of Sub-Document fetch operations like, Get("path") and Exists("path") into a single atomic fetch. The result is strongly typed.
Declaration
public static async Task<IMutateInResult<TDocument>> MutateInAsync<TDocument>(this ICouchbaseCollection collection, string id, Action<MutateInSpecBuilder<TDocument>> configureBuilder, MutateInOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
String | id | The id of the document. |
Action<MutateInSpecBuilder<TDocument>> | configureBuilder | An array of fetch operations - requires at least one: exists, get, count. |
MutateInOptions | options | Any optional parameters. |
Returns
Type | Description |
---|---|
Task<IMutateInResult<TDocument>> | An asychronous |
Type Parameters
Name | Description |
---|---|
TDocument | The document |
Queue<T>(ICouchbaseCollection, String)
Get an IPersistentQueue<T> backed by a given document.
Declaration
public static IPersistentQueue<T> Queue<T>(this ICouchbaseCollection collection, string docId)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
String | docId | Document ID which backs the queue. |
Returns
Type | Description |
---|---|
IPersistentQueue<T> | The persistent queue. |
Type Parameters
Name | Description |
---|---|
T |
Remarks
If using a SystemTextJsonSerializer backed by a
RemoveAsync(ICouchbaseCollection, String)
Removes an existing document in Couchbase server, failing if it does not exist.
Declaration
public static Task RemoveAsync(this ICouchbaseCollection collection, string id)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
String | id | The id of the document. |
Returns
Type | Description |
---|---|
Task | An asychronous |
RemoveAsync(ICouchbaseCollection, String, Action<RemoveOptions>)
Removes an existing document in Couchbase server, failing if it does not exist.
Declaration
public static Task RemoveAsync(this ICouchbaseCollection collection, string id, Action<RemoveOptions> configureOptions)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
String | id | The id of the document. |
Action<RemoveOptions> | configureOptions | Any optional parameters. |
Returns
Type | Description |
---|---|
Task | An asychronous |
ReplaceAsync<T>(ICouchbaseCollection, String, T)
Replaces an existing document in Couchbase server, failing if it does not exist. Maps to Memcached SET command.
Declaration
public static Task<IMutationResult> ReplaceAsync<T>(this ICouchbaseCollection collection, string id, T content)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
String | id | The id of the document. |
T | content | The content or document body. |
Returns
Type | Description |
---|---|
Task<IMutationResult> | An asychronous |
Type Parameters
Name | Description |
---|---|
T | The |
ReplaceAsync<T>(ICouchbaseCollection, String, T, Action<ReplaceOptions>)
Replaces an existing document in Couchbase server, failing if it does not exist. Maps to Memcached SET command.
Declaration
public static Task<IMutationResult> ReplaceAsync<T>(this ICouchbaseCollection collection, string id, T content, Action<ReplaceOptions> configureOptions)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
String | id | The id of the document. |
T | content | The content or document body. |
Action<ReplaceOptions> | configureOptions | Any optional parameters. |
Returns
Type | Description |
---|---|
Task<IMutationResult> | An asychronous |
Type Parameters
Name | Description |
---|---|
T | The |
Set<T>(ICouchbaseCollection, String)
Get an IPersistentSet<TValue> backed by a given document.
Declaration
public static IPersistentSet<T> Set<T>(this ICouchbaseCollection collection, string docId)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
String | docId | Document ID which backs the set. |
Returns
Type | Description |
---|---|
IPersistentSet<T> | The persistent set. |
Type Parameters
Name | Description |
---|---|
T |
Remarks
If using a SystemTextJsonSerializer backed by a
TouchAsync(ICouchbaseCollection, String, TimeSpan)
Updates the expiration a document given an id, without modifying or returning its value.
Declaration
public static Task TouchAsync(this ICouchbaseCollection collection, string id, TimeSpan expiry)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
String | id | The id of the document. |
TimeSpan | expiry | The |
Returns
Type | Description |
---|---|
Task | An asychronous |
TouchAsync(ICouchbaseCollection, String, TimeSpan, Action<TouchOptions>)
Updates the expiration a document given an id, without modifying or returning its value.
Declaration
public static Task TouchAsync(this ICouchbaseCollection collection, string id, TimeSpan expiry, Action<TouchOptions> configureOptions)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
String | id | The id of the document. |
TimeSpan | expiry | The |
Action<TouchOptions> | configureOptions | Any optional parameters. |
Returns
Type | Description |
---|---|
Task | An asychronous |
UnlockAsync(ICouchbaseCollection, String, UInt64)
Unlocks a document pessimistically locked by a GetAndLock operation.
Declaration
public static Task UnlockAsync(this ICouchbaseCollection collection, string id, ulong cas)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
String | id | The id of the document. |
UInt64 | cas | The CAS from the GetAndLock operation. |
Returns
Type | Description |
---|---|
Task | An asychronous |
UnlockAsync(ICouchbaseCollection, String, UInt64, Action<UnlockOptions>)
Unlocks a document pessimistically locked by a GetAndLock operation.
Declaration
public static Task UnlockAsync(this ICouchbaseCollection collection, string id, ulong cas, Action<UnlockOptions> configureOptions)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
String | id | The id of the document. |
UInt64 | cas | The CAS from the GetAndLock operation. |
Action<UnlockOptions> | configureOptions | Any optional parameters. |
Returns
Type | Description |
---|---|
Task | An asychronous |
UnlockAsync<T>(ICouchbaseCollection, String, UInt64)
Declaration
public static Task UnlockAsync<T>(this ICouchbaseCollection collection, string id, ulong cas)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | |
String | id | |
UInt64 | cas |
Returns
Type | Description |
---|---|
Task |
Type Parameters
Name | Description |
---|---|
T |
UnlockAsync<T>(ICouchbaseCollection, String, UInt64, Action<UnlockOptions>)
Declaration
public static Task UnlockAsync<T>(this ICouchbaseCollection collection, string id, ulong cas, Action<UnlockOptions> configureOptions)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | |
String | id | |
UInt64 | cas | |
Action<UnlockOptions> | configureOptions |
Returns
Type | Description |
---|---|
Task |
Type Parameters
Name | Description |
---|---|
T |
UpsertAsync<T>(ICouchbaseCollection, String, T)
Insert a new document or overwrite an existing document in Couchbase server. Maps to Memcached Set command.
Declaration
public static Task<IMutationResult> UpsertAsync<T>(this ICouchbaseCollection collection, string id, T content)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
String | id | The id of the document. |
T | content | The content or document body. |
Returns
Type | Description |
---|---|
Task<IMutationResult> | An asychronous |
Type Parameters
Name | Description |
---|---|
T | The |
UpsertAsync<T>(ICouchbaseCollection, String, T, Action<UpsertOptions>)
Insert a new document or overwrite an existing document in Couchbase server. Maps to Memcached Set command.
Declaration
public static Task<IMutationResult> UpsertAsync<T>(this ICouchbaseCollection collection, string id, T content, Action<UpsertOptions> configureOptions)
Parameters
Type | Name | Description |
---|---|---|
ICouchbaseCollection | collection | Couchbase collection. |
String | id | The id of the document. |
T | content | The content or document body. |
Action<UpsertOptions> | configureOptions | Optional parameters |
Returns
Type | Description |
---|---|
Task<IMutationResult> | An asychronous |
Type Parameters
Name | Description |
---|---|
T | The |