Couchbase .NET SDK | 3.4.4
Search Results for

    Show / Hide Table of Contents

    Interface ICouchbaseCollection

    Represents a collection of JSON objects in Couchbase.

    Namespace: Couchbase.KeyValue
    Assembly: Couchbase.NetClient.dll
    Syntax
    public interface ICouchbaseCollection

    Properties

    | Improve this Doc View Source

    Binary

    A special collection for non-JSON operations; maps to binary operation in the older API's.

    Declaration
    IBinaryCollection Binary { get; }
    Property Value
    Type Description
    IBinaryCollection
    | Improve this Doc View Source

    Cid

    The identifier for the collection.

    Declaration
    uint? Cid { get; }
    Property Value
    Type Description
    Nullable<UInt32>
    | Improve this Doc View Source

    IsDefaultCollection

    Returns true if this is the default collection in the default scope.

    Declaration
    bool IsDefaultCollection { get; }
    Property Value
    Type Description
    Boolean
    | Improve this Doc View Source

    Name

    The name of the collection.

    Declaration
    string Name { get; }
    Property Value
    Type Description
    String
    | Improve this Doc View Source

    QueryIndexes

    Provides access to the indexes at the Collection level.

    Declaration
    ICollectionQueryIndexManager QueryIndexes { get; }
    Property Value
    Type Description
    ICollectionQueryIndexManager
    | Improve this Doc View Source

    Scope

    Scope which owns this collection.

    Declaration
    IScope Scope { get; }
    Property Value
    Type Description
    IScope

    Methods

    | Improve this Doc View Source

    ExistsAsync(String, ExistsOptions)

    Returns true if a document exists for a given id, otherwise false.

    Declaration
    Task<IExistsResult> ExistsAsync(string id, ExistsOptions options = null)
    Parameters
    Type Name Description
    String id

    The id of the document.

    ExistsOptions options

    Any optional parameters.

    Returns
    Type Description
    Task<IExistsResult>

    An asychronous containing an IExistsResult object with a boolean value indicating the presence of the document.

    | Improve this Doc View Source

    GetAllReplicasAsync(String, GetAllReplicasOptions)

    Gets a list of document data from the server, leveraging both the active and all available replicas.

    Declaration
    IEnumerable<Task<IGetReplicaResult>> GetAllReplicasAsync(string id, GetAllReplicasOptions options = null)
    Parameters
    Type Name Description
    String id

    The id of the document.

    GetAllReplicasOptions options

    Any optional parameters.

    Returns
    Type Description
    IEnumerable<Task<IGetReplicaResult>>

    An asychronous containing the JSON object or scalar encapsulated in a list of IGetReplicaResult API objects.

    | Improve this Doc View Source

    GetAndLockAsync(String, TimeSpan, GetAndLockOptions)

    Gets a document for a given id and places a pessimistic lock on it for mutations.

    Declaration
    Task<IGetResult> GetAndLockAsync(string id, TimeSpan expiry, GetAndLockOptions options = null)
    Parameters
    Type Name Description
    String id

    The id of the document.

    TimeSpan expiry

    The duration of the lock.

    GetAndLockOptions options

    Any optional parameters.

    Returns
    Type Description
    Task<IGetResult>

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

    Remarks

    The maximum amount of time a key can be locked is 30 seconds; any parameter you provide that is more than 30 seconds will be set to 30 seconds; negative numbers will be interpreted as 30 seconds also.

    | Improve this Doc View Source

    GetAndTouchAsync(String, TimeSpan, GetAndTouchOptions)

    Gets a document for a given id and extends its expiration.

    Declaration
    Task<IGetResult> GetAndTouchAsync(string id, TimeSpan expiry, GetAndTouchOptions options = null)
    Parameters
    Type Name Description
    String id

    The id of the document.

    TimeSpan expiry

    The duration of the lock.

    GetAndTouchOptions options

    Any optional parameters.

    Returns
    Type Description
    Task<IGetResult>

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

    | Improve this Doc View Source

    GetAnyReplicaAsync(String, GetAnyReplicaOptions)

    Gets a document for a given id, leveraging both the active and all available replicas. This method follows the same semantics of GetAllReplicas (including the fetch from ACTIVE), but returns the first response as opposed to returning all responses.

    Declaration
    Task<IGetReplicaResult> GetAnyReplicaAsync(string id, GetAnyReplicaOptions options = null)
    Parameters
    Type Name Description
    String id

    The id of the document.

    GetAnyReplicaOptions options

    Any optional parameters.

    Returns
    Type Description
    Task<IGetReplicaResult>

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

    | Improve this Doc View Source

    GetAsync(String, GetOptions)

    Fetches a value from the server if it exists.

    Declaration
    Task<IGetResult> GetAsync(string id, GetOptions options = null)
    Parameters
    Type Name Description
    String id

    The id of the document.

    GetOptions options

    Optional parameters.

    Returns
    Type Description
    Task<IGetResult>

    An asychronous containing the JSON object or scalar encapsulated in an IGetResult API object.

    | Improve this Doc View Source

    InsertAsync<T>(String, T, InsertOptions)

    Insert a JSON document, failing if it already exists. Maps to Memcached Add command.

    Declaration
    Task<IMutationResult> InsertAsync<T>(string id, T content, InsertOptions options = null)
    Parameters
    Type Name Description
    String id

    The id of the document.

    T content

    The content or document body.

    InsertOptions options

    Any optional parameters.

    Returns
    Type Description
    Task<IMutationResult>

    An asychronous 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

    LookupInAsync(String, IEnumerable<LookupInSpec>, LookupInOptions)

    Allows the chaining of Sub-Document fetch operations like, Get("path") and Exists("path") into a single atomic fetch.

    Declaration
    Task<ILookupInResult> LookupInAsync(string id, IEnumerable<LookupInSpec> specs, LookupInOptions options = null)
    Parameters
    Type Name Description
    String id

    The id of the document.

    IEnumerable<LookupInSpec> specs

    An array of fetch operations - requires at least one: exists, get, count. There is a server enforced maximum of 16 sub document operations allowed per call.

    LookupInOptions options

    Any optional parameters.

    Returns
    Type Description
    Task<ILookupInResult>

    An asychronous containing the results of the lookup as an ILookupInResult object.

    | Improve this Doc View Source

    MutateInAsync(String, IEnumerable<MutateInSpec>, MutateInOptions)

    Allows the chaining of Sub-Document mutation operations on a specific document in a single atomic transaction.

    Declaration
    Task<IMutateInResult> MutateInAsync(string id, IEnumerable<MutateInSpec> specs, MutateInOptions options = null)
    Parameters
    Type Name Description
    String id

    The id of the document.

    IEnumerable<MutateInSpec> specs

    An array of fetch operations - requires at least one: exists, get, count. There is a server enforced maximum of 16 sub document operations allowed per call.

    MutateInOptions options

    Any optional parameters.

    Returns
    Type Description
    Task<IMutateInResult>

    An asychronous containing the results of the mutation as an IMutateInResult object.

    | Improve this Doc View Source

    RemoveAsync(String, RemoveOptions)

    Removes an existing document in Couchbase server, failing if it does not exist.

    Declaration
    Task RemoveAsync(string id, RemoveOptions options = null)
    Parameters
    Type Name Description
    String id

    The id of the document.

    RemoveOptions options

    Any optional parameters.

    Returns
    Type Description
    Task

    An asychronous object for awaiting.

    | Improve this Doc View Source

    ReplaceAsync<T>(String, T, ReplaceOptions)

    Replaces an existing document in Couchbase server, failing if it does not exist. Maps to Memcached SET command.

    Declaration
    Task<IMutationResult> ReplaceAsync<T>(string id, T content, ReplaceOptions options = null)
    Parameters
    Type Name Description
    String id

    The id of the document.

    T content

    The content or document body.

    ReplaceOptions options

    Any optional parameters.

    Returns
    Type Description
    Task<IMutationResult>

    An asychronous 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

    ScanAsync(IScanType, ScanOptions)

    Declaration
    IAsyncEnumerable<IScanResult> ScanAsync(IScanType scanType, ScanOptions options = null)
    Parameters
    Type Name Description
    IScanType scanType
    ScanOptions options
    Returns
    Type Description
    IAsyncEnumerable<IScanResult>
    | Improve this Doc View Source

    TouchAsync(String, TimeSpan, TouchOptions)

    Updates the expiration a document given an id, without modifying or returning its value.

    Declaration
    Task TouchAsync(string id, TimeSpan expiry, TouchOptions options = null)
    Parameters
    Type Name Description
    String id

    The id of the document.

    TimeSpan expiry

    The expiry of the new expiration time.

    TouchOptions options

    Any optional parameters.

    Returns
    Type Description
    Task

    An asychronous object for awaiting.

    | Improve this Doc View Source

    UnlockAsync(String, UInt64, UnlockOptions)

    Unlocks a document pessimistically locked by a GetAndLock operation.

    Declaration
    Task UnlockAsync(string id, ulong cas, UnlockOptions options = null)
    Parameters
    Type Name Description
    String id

    The id of the document.

    UInt64 cas

    The CAS from the GetAndLock operation.

    UnlockOptions options

    Any optional parameters.

    Returns
    Type Description
    Task

    An asychronous object for awaiting.

    | Improve this Doc View Source

    UnlockAsync<T>(String, UInt64, UnlockOptions)

    Declaration
    Task UnlockAsync<T>(string id, ulong cas, UnlockOptions options = null)
    Parameters
    Type Name Description
    String id
    UInt64 cas
    UnlockOptions options
    Returns
    Type Description
    Task
    Type Parameters
    Name Description
    T
    | Improve this Doc View Source

    UpsertAsync<T>(String, T, UpsertOptions)

    Insert a new document or overwrite an existing document in Couchbase server. Maps to Memcached Set command.

    Declaration
    Task<IMutationResult> UpsertAsync<T>(string id, T content, UpsertOptions options = null)
    Parameters
    Type Name Description
    String id

    The id of the document.

    T content

    The content or document body.

    UpsertOptions options

    Any optional parameters.

    Returns
    Type Description
    Task<IMutationResult>

    An asychronous 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.

    Extension Methods

    CollectionExtensions.TryGetAsync(ICouchbaseCollection, String)
    CollectionExtensions.TryGetAsync(ICouchbaseCollection, String, Action<GetOptions>)
    CollectionExtensions.GetAsync(ICouchbaseCollection, String)
    CollectionExtensions.GetAsync(ICouchbaseCollection, String, Action<GetOptions>)
    CollectionExtensions.GetAnyReplicaAsync(ICouchbaseCollection, String)
    CollectionExtensions.GetAnyReplicaAsync(ICouchbaseCollection, String, Action<GetAnyReplicaOptions>)
    CollectionExtensions.GetAllReplicasAsync(ICouchbaseCollection, String)
    CollectionExtensions.GetAllReplicasAsync(ICouchbaseCollection, String, Action<GetAllReplicasOptions>)
    CollectionExtensions.ExistsAsync(ICouchbaseCollection, String)
    CollectionExtensions.ExistsAsync(ICouchbaseCollection, String, Action<ExistsOptions>)
    CollectionExtensions.UpsertAsync<T>(ICouchbaseCollection, String, T)
    CollectionExtensions.UpsertAsync<T>(ICouchbaseCollection, String, T, Action<UpsertOptions>)
    CollectionExtensions.InsertAsync<T>(ICouchbaseCollection, String, T)
    CollectionExtensions.InsertAsync<T>(ICouchbaseCollection, String, T, Action<InsertOptions>)
    CollectionExtensions.ReplaceAsync<T>(ICouchbaseCollection, String, T)
    CollectionExtensions.ReplaceAsync<T>(ICouchbaseCollection, String, T, Action<ReplaceOptions>)
    CollectionExtensions.RemoveAsync(ICouchbaseCollection, String)
    CollectionExtensions.RemoveAsync(ICouchbaseCollection, String, Action<RemoveOptions>)
    CollectionExtensions.UnlockAsync<T>(ICouchbaseCollection, String, UInt64)
    CollectionExtensions.UnlockAsync<T>(ICouchbaseCollection, String, UInt64, Action<UnlockOptions>)
    CollectionExtensions.UnlockAsync(ICouchbaseCollection, String, UInt64)
    CollectionExtensions.UnlockAsync(ICouchbaseCollection, String, UInt64, Action<UnlockOptions>)
    CollectionExtensions.TouchAsync(ICouchbaseCollection, String, TimeSpan)
    CollectionExtensions.TouchAsync(ICouchbaseCollection, String, TimeSpan, Action<TouchOptions>)
    CollectionExtensions.GetAndTouchAsync(ICouchbaseCollection, String, TimeSpan)
    CollectionExtensions.GetAndTouchAsync(ICouchbaseCollection, String, TimeSpan, Action<GetAndTouchOptions>)
    CollectionExtensions.GetAndLockAsync(ICouchbaseCollection, String, TimeSpan)
    CollectionExtensions.GetAndLockAsync(ICouchbaseCollection, String, TimeSpan, Action<GetAndLockOptions>)
    CollectionExtensions.LookupInAsync(ICouchbaseCollection, String, Action<LookupInSpecBuilder>)
    CollectionExtensions.LookupInAsync(ICouchbaseCollection, String, Action<LookupInSpecBuilder>, Action<LookupInOptions>)
    CollectionExtensions.LookupInAsync(ICouchbaseCollection, String, Action<LookupInSpecBuilder>, LookupInOptions)
    CollectionExtensions.LookupInAsync(ICouchbaseCollection, String, IEnumerable<LookupInSpec>)
    CollectionExtensions.LookupInAsync(ICouchbaseCollection, String, IEnumerable<LookupInSpec>, Action<LookupInOptions>)
    CollectionExtensions.LookupInAsync<TDocument>(ICouchbaseCollection, String, Action<LookupInSpecBuilder<TDocument>>, Action<LookupInOptions>)
    CollectionExtensions.LookupInAsync<TDocument>(ICouchbaseCollection, String, Action<LookupInSpecBuilder<TDocument>>, LookupInOptions)
    CollectionExtensions.MutateInAsync(ICouchbaseCollection, String, Action<MutateInSpecBuilder>)
    CollectionExtensions.MutateInAsync(ICouchbaseCollection, String, Action<MutateInSpecBuilder>, Action<MutateInOptions>)
    CollectionExtensions.MutateInAsync(ICouchbaseCollection, String, Action<MutateInSpecBuilder>, MutateInOptions)
    CollectionExtensions.MutateInAsync(ICouchbaseCollection, String, IEnumerable<MutateInSpec>)
    CollectionExtensions.MutateInAsync(ICouchbaseCollection, String, IEnumerable<MutateInSpec>, Action<MutateInOptions>)
    CollectionExtensions.MutateInAsync<TDocument>(ICouchbaseCollection, String, Action<MutateInSpecBuilder<TDocument>>, Action<MutateInOptions>)
    CollectionExtensions.MutateInAsync<TDocument>(ICouchbaseCollection, String, Action<MutateInSpecBuilder<TDocument>>, MutateInOptions)
    CollectionExtensions.Set<T>(ICouchbaseCollection, String)
    CollectionExtensions.List<T>(ICouchbaseCollection, String)
    CollectionExtensions.Queue<T>(ICouchbaseCollection, String)
    CollectionExtensions.Dictionary<TValue>(ICouchbaseCollection, String)
    • Improve this Doc
    • View Source
    In This Article
    Back to top © 2023 Couchbase, Inc.