Class CollectionExtensions
Inherited Members
Namespace: Couchbase.KeyValue
Assembly: Couchbase.NetClient.dll
Syntax
public static class CollectionExtensions
Methods
| Edit this page View SourceDictionary<TValue>(ICouchbaseCollection, string)
Get an IPersistent
Declaration
public static IPersistentDictionary<TValue> Dictionary<TValue>(this ICouchbaseCollection collection, string docId)
Parameters
Type | Name | Description |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | docId | Document ID which backs the dictionary. |
Returns
Type | Description |
---|---|
IPersistent |
The persistent dictionary. |
Type Parameters
Name | Description |
---|---|
TValue |
Remarks
If using a SystemIDictionary<string, TValue>
in a Json
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 |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
Returns
Type | Description |
---|---|
Task<IExists |
An asynchronous Task containing an IExists |
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 |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
Action<Exists |
configureOptions | Optional parameters |
Returns
Type | Description |
---|---|
Task<IExists |
An asynchronous Task containing an IExists |
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 |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
Returns
Type | Description |
---|---|
IEnumerable<Task<IGet |
An asynchronous Task containing the JSON object or scalar encapsulated in a list of IGet |
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 |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
Action<Get |
configureOptions | Optional parameters |
Returns
Type | Description |
---|---|
IEnumerable<Task<IGet |
An asynchronous Task containing the JSON object or scalar encapsulated in a list of IGet |
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 |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
Time |
expiry | The duration of the lock. |
Returns
Type | Description |
---|---|
Task<IGet |
An asynchronous Task The JSON object or scalar encapsulated in a IGet |
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 |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
Time |
expiry | The Time |
Action<Get |
configureOptions | Any optional parameters. |
Returns
Type | Description |
---|---|
Task<IGet |
An asynchronous Task The JSON object or scalar encapsulated in a IGet |
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 |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
Time |
expiry | The Time |
Returns
Type | Description |
---|---|
Task<IGet |
An asynchronous Task The JSON object or scalar encapsulated in a IGet |
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 |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
Time |
expiry | The Time |
Action<Get |
configureOptions | Any optional parameters. |
Returns
Type | Description |
---|---|
Task<IGet |
An asynchronous Task The JSON object or scalar encapsulated in a IGet |
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 |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
Returns
Type | Description |
---|---|
Task<IGet |
An asynchronous Task The JSON object or scalar encapsulated in a IGet |
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 |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
Action<Get |
configureOptions | Optional parameters |
Returns
Type | Description |
---|---|
Task<IGet |
An asynchronous Task containing the JSON object or scalar encapsulated in a list of IGet |
GetAsync(ICouchbaseCollection, string)
Fetches a value from the server if it exists. If the document does not exist in the database,
a Document
Declaration
public static Task<IGetResult> GetAsync(this ICouchbaseCollection collection, string id)
Parameters
Type | Name | Description |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | Primary key as a string. |
Returns
Type | Description |
---|---|
Task<IGet |
An asynchronous Task containing the JSON object or scalar encapsulated in an IGet |
GetAsync(ICouchbaseCollection, string, Action<GetOptions>)
Fetches a value from the server if it exists.If the document does not exist in the database,
a Document
Declaration
public static Task<IGetResult> GetAsync(this ICouchbaseCollection collection, string id, Action<GetOptions> configureOptions)
Parameters
Type | Name | Description |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | Primary key as a string. |
Action<Get |
configureOptions | Optional parameters. |
Returns
Type | Description |
---|---|
Task<IGet |
An asynchronous Task containing the JSON object or scalar encapsulated in an IGet |
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 |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
T | content | The content or document body. |
Returns
Type | Description |
---|---|
Task<IMutation |
An asynchronous Task containing a IMutationResult object if successful otherwise an exception with details for the reason the operation failed. |
Type Parameters
Name | Description |
---|---|
T | The Type of content to insert. |
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 |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
T | content | The content or document body. |
Action<Insert |
optionsAction | Any optional parameters. |
Returns
Type | Description |
---|---|
Task<IMutation |
An asynchronous Task containing a IMutationResult object if successful otherwise an exception with details for the reason the operation failed. |
Type Parameters
Name | Description |
---|---|
T | The Type of content to insert. |
List<T>(ICouchbaseCollection, string)
Get an IPersistent
Declaration
public static IPersistentList<T> List<T>(this ICouchbaseCollection collection, string docId)
Parameters
Type | Name | Description |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | docId | Document ID which backs the list. |
Returns
Type | Description |
---|---|
IPersistent |
The persistent list. |
Type Parameters
Name | Description |
---|---|
T |
Remarks
If using a System
LookupInAllReplicasAsync(ICouchbaseCollection, string, Action<LookupInSpecBuilder>, LookupInAllReplicasOptions?)
Allows the chaining of Sub-Document fetch operations like, Get("path") and Exists("path") into a single atomic fetch.
Declaration
public static IAsyncEnumerable<ILookupInReplicaResult> LookupInAllReplicasAsync(this ICouchbaseCollection collection, string id, Action<LookupInSpecBuilder> configureBuilder, LookupInAllReplicasOptions? options = null)
Parameters
Type | Name | Description |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
Action<Lookup |
configureBuilder | 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. |
Lookup |
options | Any optional parameters. |
Returns
Type | Description |
---|---|
IAsync |
LookupInAllReplicasAsync(ICouchbaseCollection, string, Action<LookupInSpecBuilder>, Action<LookupInAllReplicasOptions>)
Allows the chaining of Sub-Document fetch operations like, Get("path") and Exists("path") into a single atomic fetch, as well as the chaining of option configurations.
Declaration
[InterfaceStability(Level.Volatile)]
public static IAsyncEnumerable<ILookupInReplicaResult> LookupInAllReplicasAsync(this ICouchbaseCollection collection, string id, Action<LookupInSpecBuilder> configureBuilder, Action<LookupInAllReplicasOptions> configureOptions)
Parameters
Type | Name | Description |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
Action<Lookup |
configureBuilder | 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<Lookup |
configureOptions | Any optional parameters. |
Returns
Type | Description |
---|---|
IAsync |
LookupInAllReplicasAsync(ICouchbaseCollection, string, IEnumerable<LookupInSpec>, Action<LookupInAllReplicasOptions>)
Allows the chaining of option configurations into a single operation.
Declaration
[InterfaceStability(Level.Volatile)]
public static IAsyncEnumerable<ILookupInReplicaResult> LookupInAllReplicasAsync(this ICouchbaseCollection collection, string id, IEnumerable<LookupInSpec> specs, Action<LookupInAllReplicasOptions> configureOptions)
Parameters
Type | Name | Description |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
IEnumerable<Lookup |
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<Lookup |
configureOptions | Any optional parameters. |
Returns
Type | Description |
---|---|
IAsync |
LookupInAnyReplicaAsync(ICouchbaseCollection, string, Action<LookupInSpecBuilder>, LookupInAnyReplicaOptions?)
Allows the chaining of Sub-Document fetch operations like, Get("path") and Exists("path") into a single atomic fetch.
Declaration
[InterfaceStability(Level.Volatile)]
public static Task<ILookupInReplicaResult> LookupInAnyReplicaAsync(this ICouchbaseCollection collection, string id, Action<LookupInSpecBuilder> configureBuilder, LookupInAnyReplicaOptions? options = null)
Parameters
Type | Name | Description |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
Action<Lookup |
configureBuilder | 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. |
Lookup |
options | Any optional parameters. |
Returns
Type | Description |
---|---|
Task<ILookup |
LookupInAnyReplicaAsync(ICouchbaseCollection, string, Action<LookupInSpecBuilder>, Action<LookupInAnyReplicaOptions>)
Allows the chaining of Sub-Document fetch operations like, Get("path") and Exists("path") into a single atomic fetch, as well as the chaining of option configurations.
Declaration
[InterfaceStability(Level.Volatile)]
public static Task<ILookupInReplicaResult> LookupInAnyReplicaAsync(this ICouchbaseCollection collection, string id, Action<LookupInSpecBuilder> configureBuilder, Action<LookupInAnyReplicaOptions> configureOptions)
Parameters
Type | Name | Description |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
Action<Lookup |
configureBuilder | 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<Lookup |
configureOptions | Any optional parameters. |
Returns
Type | Description |
---|---|
Task<ILookup |
LookupInAnyReplicaAsync(ICouchbaseCollection, string, IEnumerable<LookupInSpec>, Action<LookupInAnyReplicaOptions>)
Allows the chaining of option configurations into a single operation.
Declaration
[InterfaceStability(Level.Volatile)]
public static Task<ILookupInReplicaResult> LookupInAnyReplicaAsync(this ICouchbaseCollection collection, string id, IEnumerable<LookupInSpec> specs, Action<LookupInAnyReplicaOptions> configureOptions)
Parameters
Type | Name | Description |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
IEnumerable<Lookup |
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<Lookup |
configureOptions | Any optional parameters. |
Returns
Type | Description |
---|---|
Task<ILookup |
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 |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
Action<Lookup |
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<ILookup |
An asynchronous Task containing the results of the lookup as an ILookup |
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 |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
Action<Lookup |
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. |
Lookup |
options | Any optional parameters. |
Returns
Type | Description |
---|---|
Task<ILookup |
An asynchronous Task containing the results of the lookup as an ILookup |
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 |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
Action<Lookup |
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<Lookup |
configureOptions | Any optional parameters. |
Returns
Type | Description |
---|---|
Task<ILookup |
An asynchronous Task containing the results of the lookup as an ILookup |
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 |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
IEnumerable<Lookup |
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<ILookup |
An asynchronous Task containing the results of the lookup as an ILookup |
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 |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
IEnumerable<Lookup |
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<Lookup |
configureOptions | Any optional parameters. |
Returns
Type | Description |
---|---|
Task<ILookup |
An asynchronous Task containing the results of the lookup as an ILookup |
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
[InterfaceStability(Level.Volatile)]
public static Task<ILookupInResult<TDocument>> LookupInAsync<TDocument>(this ICouchbaseCollection collection, string id, Action<LookupInSpecBuilder<TDocument>> configureBuilder, LookupInOptions? options = null)
Parameters
Type | Name | Description |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
Action<Lookup |
configureBuilder | An array of fetch operations - requires at least one: exists, get, count. |
Lookup |
options | Any optional parameters. |
Returns
Type | Description |
---|---|
Task<ILookup |
An asynchronous Task containing the results of the lookup as an ILookup |
Type Parameters
Name | Description |
---|---|
TDocument | The document Type. |
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
[InterfaceStability(Level.Volatile)]
public static Task<ILookupInResult<TDocument>> LookupInAsync<TDocument>(this ICouchbaseCollection collection, string id, Action<LookupInSpecBuilder<TDocument>> configureBuilder, Action<LookupInOptions> configureOptions)
Parameters
Type | Name | Description |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
Action<Lookup |
configureBuilder | An array of fetch operations - requires at least one: exists, get, count. |
Action<Lookup |
configureOptions | Any optional parameters. |
Returns
Type | Description |
---|---|
Task<ILookup |
An asynchronous Task containing the results of the lookup as an ILookup |
Type Parameters
Name | Description |
---|---|
TDocument | The document Type. |
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 |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
Action<Mutate |
configureBuilder | An array of mutation Sub-Document operations: Iinsert, Upsert, Replace, Remove, ArrayPrepend, ArrayAppend, ArrayInsert, ArrayAddUnique, Increment and/or Decrement. |
Returns
Type | Description |
---|---|
Task<IMutate |
An asynchronous Task containing the results of the mutation as an IMutate |
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 |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
Action<Mutate |
configureBuilder | An array of mutation Sub-Document operations: Insert, Upsert, Replace, Remove, ArrayPrepend, ArrayAppend, ArrayInsert, ArrayAddUnique, Increment and/or Decrement. |
Mutate |
options | Any optional parameters. |
Returns
Type | Description |
---|---|
Task<IMutate |
An asynchronous Task containing the results of the mutation as an IMutate |
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 |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
Action<Mutate |
configureBuilder | An array of mutation Sub-Document operations: Insert, Upsert, Replace, Remove, ArrayPrepend, ArrayAppend, ArrayInsert, ArrayAddUnique, Increment and/or Decrement. |
Action<Mutate |
configureOptions | Any optional parameters. |
Returns
Type | Description |
---|---|
Task<IMutate |
An asynchronous Task containing the results of the mutation as an IMutate |
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 |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
IEnumerable<Mutate |
specs | An array of mutation Sub-Document operations: Insert, Upsert, Replace, Remove, ArrayPrepend, ArrayAppend, ArrayInsert, ArrayAddUnique, Increment and/or Decrement. |
Returns
Type | Description |
---|---|
Task<IMutate |
An asynchronous Task containing the results of the mutation as an IMutate |
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 |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
IEnumerable<Mutate |
specs | An array of mutation Sub-Document operations: Insert, Upsert, Replace, Remove, ArrayPrepend, ArrayAppend, ArrayInsert, ArrayAddUnique, Increment and/or Decrement. |
Action<Mutate |
configureOptions | Any optional parameters. |
Returns
Type | Description |
---|---|
Task<IMutate |
An asynchronous Task containing the results of the mutation as an IMutate |
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
[InterfaceStability(Level.Volatile)]
public static Task<IMutateInResult<TDocument>> MutateInAsync<TDocument>(this ICouchbaseCollection collection, string id, Action<MutateInSpecBuilder<TDocument>> configureBuilder, MutateInOptions? options = null)
Parameters
Type | Name | Description |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
Action<Mutate |
configureBuilder | An array of fetch operations - requires at least one: exists, get, count. |
Mutate |
options | Any optional parameters. |
Returns
Type | Description |
---|---|
Task<IMutate |
An asynchronous Task containing the results of the lookup as an ILookup |
Type Parameters
Name | Description |
---|---|
TDocument | The document Type. |
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
[InterfaceStability(Level.Volatile)]
public static Task<IMutateInResult<TDocument>> MutateInAsync<TDocument>(this ICouchbaseCollection collection, string id, Action<MutateInSpecBuilder<TDocument>> configureBuilder, Action<MutateInOptions> configureOptions)
Parameters
Type | Name | Description |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
Action<Mutate |
configureBuilder | An array of fetch operations - requires at least one: exists, get, count. |
Action<Mutate |
configureOptions | Any optional parameters. |
Returns
Type | Description |
---|---|
Task<IMutate |
An asynchronous Task containing the results of the lookup as an ILookup |
Type Parameters
Name | Description |
---|---|
TDocument | The document Type. |
Queue<T>(ICouchbaseCollection, string, QueueOptions?)
Get an IPersistent
Declaration
public static IPersistentQueue<T> Queue<T>(this ICouchbaseCollection collection, string docId, QueueOptions? options = null)
Parameters
Type | Name | Description |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | docId | Document ID which backs the queue. |
Queue |
options | Behavior options for the queue implementation. |
Returns
Type | Description |
---|---|
IPersistent |
The persistent queue. |
Type Parameters
Name | Description |
---|---|
T |
Remarks
If using a System
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 |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
Returns
| Edit this page View SourceRemoveAsync(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 |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
Action<Remove |
configureOptions | Any optional parameters. |
Returns
| Edit this page View SourceReplaceAsync<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 |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
T | content | The content or document body. |
Returns
Type | Description |
---|---|
Task<IMutation |
An asynchronous Task containing a IMutation |
Type Parameters
Name | Description |
---|---|
T | The Type of content to insert. |
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 |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
T | content | The content or document body. |
Action<Replace |
configureOptions | Any optional parameters. |
Returns
Type | Description |
---|---|
Task<IMutation |
An asynchronous Task containing a IMutation |
Type Parameters
Name | Description |
---|---|
T | The Type of content to insert. |
Set<T>(ICouchbaseCollection, string)
Get an IPersistent
Declaration
public static IPersistentSet<T> Set<T>(this ICouchbaseCollection collection, string docId)
Parameters
Type | Name | Description |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | docId | Document ID which backs the set. |
Returns
Type | Description |
---|---|
IPersistent |
The persistent set. |
Type Parameters
Name | Description |
---|---|
T |
Remarks
If using a System
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 |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
Time |
expiry | The Time |
Returns
| Edit this page View SourceTouchAsync(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 |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
Time |
expiry | The Time |
Action<Touch |
configureOptions | Any optional parameters. |
Returns
| Edit this page View SourceTouchWithCasAsync(ICouchbaseCollection, string, TimeSpan)
Updates the expiration a document given an id, without modifying or returning its value.
Declaration
public static Task<IMutationResult?> TouchWithCasAsync(this ICouchbaseCollection collection, string id, TimeSpan expiry)
Parameters
Type | Name | Description |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
Time |
expiry | The Time |
Returns
Type | Description |
---|---|
Task<IMutation |
An asynchronous Task object for awaiting,
with a IMutation |
TouchWithCasAsync(ICouchbaseCollection, string, TimeSpan, Action<TouchOptions>)
Updates the expiration a document given an id, without modifying or returning its value.
Declaration
public static Task<IMutationResult?> TouchWithCasAsync(this ICouchbaseCollection collection, string id, TimeSpan expiry, Action<TouchOptions> configureOptions)
Parameters
Type | Name | Description |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
Time |
expiry | The Time |
Action<Touch |
configureOptions | Any optional parameters. |
Returns
Type | Description |
---|---|
Task<IMutation |
An asynchronous Task object for awaiting,
with a IMutation |
TryGetAndLockAsync(ICouchbaseCollection, string, TimeSpan)
Given an id, gets a document from the database and places a pessimistic lock on it for mutations. If the key is not found, a ITry
Declaration
public static Task<ITryGetResult> TryGetAndLockAsync(this ICouchbaseCollection collection, string id, TimeSpan expires)
Parameters
Type | Name | Description |
---|---|---|
ICouchbase |
collection | The ICouchbase |
string | id | The identifier for the document. |
Time |
expires |
Returns
Type | Description |
---|---|
Task<ITry |
A ITry |
TryGetAndLockAsync(ICouchbaseCollection, string, TimeSpan, Action<GetAndLockOptions>)
Given an id, gets a document from the database and places a pessimistic lock on it for mutations. If the key is not found, a ITry
Declaration
public static Task<ITryGetResult> TryGetAndLockAsync(this ICouchbaseCollection collection, string id, TimeSpan expires, Action<GetAndLockOptions> configureOptions)
Parameters
Type | Name | Description |
---|---|---|
ICouchbase |
collection | The ICouchbase |
string | id | The identifier for the document. |
Time |
expires | |
Action<Get |
configureOptions | The Get |
Returns
Type | Description |
---|---|
Task<ITry |
A ITry |
TryGetAndTouchAsync(ICouchbaseCollection, string, TimeSpan)
Given an id, gets a document from the database. If the key is not found, a ITry
Declaration
public static Task<ITryGetResult> TryGetAndTouchAsync(this ICouchbaseCollection collection, string id, TimeSpan expires)
Parameters
Type | Name | Description |
---|---|---|
ICouchbase |
collection | The ICouchbase |
string | id | The identifier for the document. |
Time |
expires |
Returns
Type | Description |
---|---|
Task<ITry |
A ITry |
TryGetAndTouchAsync(ICouchbaseCollection, string, TimeSpan, GetAndTouchOptions?)
Given an id, gets a document from the database. If the key is not found, a ITry
Declaration
public static Task<ITryGetResult> TryGetAndTouchAsync(this ICouchbaseCollection collection, string id, TimeSpan expires, GetAndTouchOptions? configureOptions = null)
Parameters
Type | Name | Description |
---|---|---|
ICouchbase |
collection | The ICouchbase |
string | id | The identifier for the document. |
Time |
expires | |
Get |
configureOptions | The Get |
Returns
Type | Description |
---|---|
Task<ITry |
A ITry |
TryGetAndTouchAsync(ICouchbaseCollection, string, TimeSpan, Action<GetAndTouchOptions>)
Given an id, gets a document from the database. If the key is not found, a ITry
Declaration
public static Task<ITryGetResult> TryGetAndTouchAsync(this ICouchbaseCollection collection, string id, TimeSpan expires, Action<GetAndTouchOptions> configureOptions)
Parameters
Type | Name | Description |
---|---|---|
ICouchbase |
collection | The ICouchbase |
string | id | The identifier for the document. |
Time |
expires | |
Action<Get |
configureOptions | The Get |
Returns
Type | Description |
---|---|
Task<ITry |
A ITry |
TryGetAsync(ICouchbaseCollection, string)
Given an id, gets a document from the database. If the key is not found, a ITry
Declaration
public static Task<ITryGetResult> TryGetAsync(this ICouchbaseCollection collection, string id)
Parameters
Type | Name | Description |
---|---|---|
ICouchbase |
collection | The ICouchbase |
string | id | The identifier for the document. |
Returns
Type | Description |
---|---|
Task<ITry |
A ITry |
TryGetAsync(ICouchbaseCollection, string, Action<GetOptions>)
Given an id, gets a document from the database. If the key is not found, a ITry
Declaration
public static Task<ITryGetResult> TryGetAsync(this ICouchbaseCollection collection, string id, Action<GetOptions> configureOptions)
Parameters
Type | Name | Description |
---|---|---|
ICouchbase |
collection | The ICouchbase |
string | id | The identifier for the document. |
Action<Get |
configureOptions | The Get |
Returns
Type | Description |
---|---|
Task<ITry |
A ITry |
TryRemoveAsync(ICouchbaseCollection, string)
Given an id, removes a document from the database. If the key is not found, a ITry
Declaration
public static Task<ITryRemoveResult> TryRemoveAsync(this ICouchbaseCollection collection, string id)
Parameters
Type | Name | Description |
---|---|---|
ICouchbase |
collection | The ICouchbase |
string | id | The identifier for the document. |
Returns
Type | Description |
---|---|
Task<ITry |
A ITry |
TryRemoveAsync(ICouchbaseCollection, string, Action<RemoveOptions>)
Given an id, removes a document from the database. If the key is not found, a ITry
Declaration
public static Task<ITryRemoveResult> TryRemoveAsync(this ICouchbaseCollection collection, string id, Action<RemoveOptions> configureOptions)
Parameters
Type | Name | Description |
---|---|---|
ICouchbase |
collection | The ICouchbase |
string | id | The identifier for the document. |
Action<Remove |
configureOptions | The Remove |
Returns
Type | Description |
---|---|
Task<ITry |
A ITry |
TryReplaceAsync<T>(ICouchbaseCollection, string, T)
Given an id, replaces a document from the database. If the key is not found, a ITry
Declaration
public static Task<ITryMutationResult> TryReplaceAsync<T>(this ICouchbaseCollection collection, string id, T content)
Parameters
Type | Name | Description |
---|---|---|
ICouchbase |
collection | The ICouchbase |
string | id | The identifier for the document. |
T | content | The document or content to store in the database. |
Returns
Type | Description |
---|---|
Task<ITry |
A ITry |
Type Parameters
Name | Description |
---|---|
T |
TryReplaceAsync<T>(ICouchbaseCollection, string, T, Action<ReplaceOptions>)
Given an id, replaces a document from the database. If the key is not found, a ITry
Declaration
public static Task<ITryMutationResult> TryReplaceAsync<T>(this ICouchbaseCollection collection, string id, T content, Action<ReplaceOptions> configureOptions)
Parameters
Type | Name | Description |
---|---|---|
ICouchbase |
collection | The ICouchbase |
string | id | The identifier for the document. |
T | content | The document or content to store in the database. |
Action<Replace |
configureOptions | The Remove |
Returns
Type | Description |
---|---|
Task<ITry |
A ITry |
Type Parameters
Name | Description |
---|---|
T |
TryTouchAsync(ICouchbaseCollection, string, TimeSpan)
Given an id, updates a documents expiry in the database. If the key is not found, a ITry
Declaration
public static Task<ITryTouchResult> TryTouchAsync(this ICouchbaseCollection collection, string id, TimeSpan expiry)
Parameters
Type | Name | Description |
---|---|---|
ICouchbase |
collection | The ICouchbase |
string | id | The identifier for the document. |
Time |
expiry | A Time |
Returns
Type | Description |
---|---|
Task<ITry |
A ITry |
TryTouchAsync(ICouchbaseCollection, string, TimeSpan, Action<TouchOptions>)
Given an id, updates a documents expiry in the database. If the key is not found, a ITry
Declaration
public static Task<ITryTouchResult> TryTouchAsync(this ICouchbaseCollection collection, string id, TimeSpan expiry, Action<TouchOptions> configureOptions)
Parameters
Type | Name | Description |
---|---|---|
ICouchbase |
collection | The ICouchbase |
string | id | The identifier for the document. |
Time |
expiry | A Time |
Action<Touch |
configureOptions | The Remove |
Returns
Type | Description |
---|---|
Task<ITry |
A ITry |
TryUnlockAsync(ICouchbaseCollection, string, ulong)
Given an id, unlocks a document from the database. If the key is not found, a ITry
Declaration
public static Task<ITryUnlockResult> TryUnlockAsync(this ICouchbaseCollection collection, string id, ulong cas)
Parameters
Type | Name | Description |
---|---|---|
ICouchbase |
collection | The ICouchbase |
string | id | The identifier for the document. |
ulong | cas | The Compare And Swap (CAS) of the document. |
Returns
Type | Description |
---|---|
Task<ITry |
A ITry |
TryUnlockAsync(ICouchbaseCollection, string, ulong, Action<UnlockOptions>)
Given an id, unlocks a document from the database. If the key is not found, a ITry
Declaration
public static Task<ITryUnlockResult> TryUnlockAsync(this ICouchbaseCollection collection, string id, ulong cas, Action<UnlockOptions> configureOptions)
Parameters
Type | Name | Description |
---|---|---|
ICouchbase |
collection | The ICouchbase |
string | id | The identifier for the document. |
ulong | cas | The Compare And Swap (CAS) of the document. |
Action<Unlock |
configureOptions | The Remove |
Returns
Type | Description |
---|---|
Task<ITry |
A ITry |
UnlockAsync(ICouchbaseCollection, string, ulong)
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 |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
ulong | cas | The CAS from the GetAndLock operation. |
Returns
| Edit this page View SourceUnlockAsync(ICouchbaseCollection, string, ulong, 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 |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
ulong | cas | The CAS from the GetAndLock operation. |
Action<Unlock |
configureOptions | Any optional parameters. |
Returns
| Edit this page View SourceUnlockAsync<T>(ICouchbaseCollection, string, ulong)
Declaration
[Obsolete("Use overload that does not have a Type parameter T.")]
public static Task UnlockAsync<T>(this ICouchbaseCollection collection, string id, ulong cas)
Parameters
Type | Name | Description |
---|---|---|
ICouchbase |
collection | |
string | id | |
ulong | cas |
Returns
Type | Description |
---|---|
Task |
Type Parameters
Name | Description |
---|---|
T |
UnlockAsync<T>(ICouchbaseCollection, string, ulong, Action<UnlockOptions>)
Declaration
[Obsolete("Use overload that does not have a Type parameter T.")]
public static Task UnlockAsync<T>(this ICouchbaseCollection collection, string id, ulong cas, Action<UnlockOptions> configureOptions)
Parameters
Type | Name | Description |
---|---|---|
ICouchbase |
collection | |
string | id | |
ulong | cas | |
Action<Unlock |
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 |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
T | content | The content or document body. |
Returns
Type | Description |
---|---|
Task<IMutation |
An asynchronous Task containing an IMutation |
Type Parameters
Name | Description |
---|---|
T | The Type of content to upsert. |
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 |
---|---|---|
ICouchbase |
collection | Couchbase collection. |
string | id | The id of the document. |
T | content | The content or document body. |
Action<Upsert |
configureOptions | Optional parameters |
Returns
Type | Description |
---|---|
Task<IMutation |
An asynchronous Task containing an IMutation |
Type Parameters
Name | Description |
---|---|
T | The Type of content to upsert. |