Couchbase .NET SDK | 3.4.2
Search Results for

    Show / Hide Table of Contents

    Class CollectionExtensions

    Inheritance
    Object
    CollectionExtensions
    Namespace: Couchbase.KeyValue
    Assembly: Couchbase.NetClient.dll
    Syntax
    public static class CollectionExtensions : object

    Methods

    | Improve this Doc View Source

    Dictionary<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 , be sure to include IDictionary<string, TValue> in a on the context.

    | Improve this Doc View Source

    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 containing an IExistsResult object with a boolean value indicating the presence of the document.

    | Improve this Doc View Source

    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 containing an IExistsResult object with a boolean value indicating the presence of the document.

    | Improve this Doc View Source

    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 containing the JSON object or scalar encapsulated in a list of IGetReplicaResult API objects.

    | Improve this Doc View Source

    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 containing the JSON object or scalar encapsulated in a list of IGetReplicaResult API objects.

    | Improve this Doc View Source

    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 The JSON object or scalar encapsulated in a IGetResult API object.

    | Improve this Doc View Source

    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 expiry of the new expiration time.

    Action<GetAndLockOptions> configureOptions

    Any optional parameters.

    Returns
    Type Description
    Task<IGetResult>

    An asychronous The JSON object or scalar encapsulated in a IGetResult API object.

    | Improve this Doc View Source

    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 expiry of the new expiration time.

    Returns
    Type Description
    Task<IGetResult>

    An asychronous The JSON object or scalar encapsulated in a IGetResult API object.

    | Improve this Doc View Source

    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 expiry of the new expiration time.

    Action<GetAndTouchOptions> configureOptions

    Any optional parameters.

    Returns
    Type Description
    Task<IGetResult>

    An asychronous The JSON object or scalar encapsulated in a IGetResult API object.

    | Improve this Doc View Source

    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 The JSON object or scalar encapsulated in a IGetReplicaResult API object.

    | Improve this Doc View Source

    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 containing the JSON object or scalar encapsulated in a list of IGetReplicaResult API objects.

    | Improve this Doc View Source

    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 containing the JSON object or scalar encapsulated in an IGetResult API object.

    | Improve this Doc View Source

    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 containing the JSON object or scalar encapsulated in an IGetResult API object.

    | Improve this Doc View Source

    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 containing a IMutationResult object if successful otherwise an exception with details for the reason the operation failed.

    Type Parameters
    Name Description
    T

    The of content to insert.

    | Improve this Doc View Source

    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 containing a IMutationResult object if successful otherwise an exception with details for the reason the operation failed.

    Type Parameters
    Name Description
    T

    The of content to insert.

    | Improve this Doc View Source

    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 , be sure to include in a on the context.

    | Improve this Doc View Source

    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 containing the results of the lookup as an ILookupInResult object.

    | Improve this Doc View Source

    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 containing the results of the lookup as an ILookupInResult object.

    | Improve this Doc View Source

    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 containing the results of the lookup as an ILookupInResult object.

    | Improve this Doc View Source

    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 containing the results of the lookup as an ILookupInResult object.

    | Improve this Doc View Source

    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 containing the results of the lookup as an ILookupInResult object.

    | Improve this Doc View Source

    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 containing the results of the lookup as an ILookupInResult of type T.

    Type Parameters
    Name Description
    TDocument

    The document .

    | Improve this Doc View Source

    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 containing the results of the lookup as an ILookupInResult of type T.

    Type Parameters
    Name Description
    TDocument

    The document .

    | Improve this Doc View Source

    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 containing the results of the mutation as an IMutateInResult object.

    | Improve this Doc View Source

    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 containing the results of the mutation as an IMutateInResult object.

    | Improve this Doc View Source

    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 containing the results of the mutation as an IMutateInResult object.

    | Improve this Doc View Source

    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 containing the results of the mutation as an IMutateInResult object.

    | Improve this Doc View Source

    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 containing the results of the mutation as an IMutateInResult object.

    | Improve this Doc View Source

    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 containing the results of the lookup as an ILookupInResult of type T.

    Type Parameters
    Name Description
    TDocument

    The document .

    | Improve this Doc View Source

    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 containing the results of the lookup as an ILookupInResult of type T.

    Type Parameters
    Name Description
    TDocument

    The document .

    | Improve this Doc View Source

    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 , be sure to include in a on the context.

    | Improve this Doc View Source

    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 object for awaiting.

    | Improve this Doc View Source

    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 object for awaiting.

    | Improve this Doc View Source

    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 containing a IMutationResult object if successful otherwise an exception with details for the reason the operation failed.

    Type Parameters
    Name Description
    T

    The of content to insert.

    | Improve this Doc View Source

    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 containing a IMutationResult object if successful otherwise an exception with details for the reason the operation failed.

    Type Parameters
    Name Description
    T

    The of content to insert.

    | Improve this Doc View Source

    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 , be sure to include in a on the context.

    | Improve this Doc View Source

    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 expiry of the new expiration time.

    Returns
    Type Description
    Task

    An asychronous object for awaiting.

    | Improve this Doc View Source

    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 expiry of the new expiration time.

    Action<TouchOptions> configureOptions

    Any optional parameters.

    Returns
    Type Description
    Task

    An asychronous object for awaiting.

    | Improve this Doc View Source

    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 object for awaiting.

    | Improve this Doc View Source

    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 object for awaiting.

    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    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 containing an IMutationResult object if successful otherwise an exception with details for the reason the operation failed.

    Type Parameters
    Name Description
    T

    The of content to upsert.

    | Improve this Doc View Source

    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 containing an IMutationResult object if successful otherwise an exception with details for the reason the operation failed.

    Type Parameters
    Name Description
    T

    The of content to upsert.

    • Improve this Doc
    • View Source
    In This Article
    Back to top © 2023 Couchbase, Inc.