Collection

class acouchbase.collection.AsyncCollection(scope: AsyncScope, name: str)

A collection in a scope, and the key-value operations on its documents.

Get one from collection().

Parameters:
  • scope (Scope) – The scope the collection belongs to.

  • name (str) – The name of the collection.

binary() → BinaryCollection

Get the binary operations on this collection.

See also

BinaryCollection

Returns:

A BinaryCollection instance.

Return type:

BinaryCollection

couchbase_list(key: str) → CouchbaseList

Returns a CouchbaseList permitting simple list storage in a document.

See also

CouchbaseList

Returns:

A CouchbaseList instance.

Return type:

CouchbaseList

couchbase_map(key: str) → CouchbaseMap

Returns a CouchbaseMap permitting simple map storage in a document.

See also

CouchbaseMap

Returns:

A CouchbaseMap instance.

Return type:

CouchbaseMap

couchbase_queue(key: str) → CouchbaseQueue

Returns a CouchbaseQueue permitting simple map storage in a document.

See also

CouchbaseQueue

Returns:

A CouchbaseQueue instance.

Return type:

CouchbaseQueue

couchbase_set(key: str) → CouchbaseSet

Returns a CouchbaseSet permitting simple map storage in a document.

See also

CouchbaseSet

Returns:

A CouchbaseSet instance.

Return type:

CouchbaseSet

static default_name() → str

The name of a bucket’s default collection.

async exists(key: str, opts: ExistsOptions | None = None, **kwargs: Unpack[ExistsOptionsKwargs]) → ExistsResult

Checks whether a specific document exists or not.

Parameters:
  • key (str) – The key for the document to check existence.

  • opts (ExistsOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used in place or to override provided ExistsOptions

Returns:

A future that contains an instance of ExistsResult if successful.

Return type:

Awaitable[ExistsResult]

Examples

Simple exists operation:

bucket = cluster.bucket('travel-sample')
collection = bucket.scope('inventory').collection('airline')

key = 'airline_10'
res = await collection.exists(key)
print(f'Document w/ key - {key} {"exists" if res.exists else "does not exist"}')

Simple exists operation with options:

from datetime import timedelta
from acouchbase.options import ExistsOptions

# ... other code ...

key = 'airline_10'
res = await collection.exists(key, ExistsOptions(timeout=timedelta(seconds=2)))
print(f'Document w/ key - {key} {"exists" if res.exists else "does not exist"}')
async get(key: str, opts: GetOptions | None = None, **kwargs: Unpack[GetOptionsKwargs]) → GetResult

Retrieves the value of a document from the collection.

Parameters:
  • key (str) – The key for the document to retrieve.

  • opts (GetOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used in place or to override provided GetOptions

Returns:

A future that contains an instance of GetResult if successful.

Return type:

Awaitable[GetResult]

Raises:

DocumentNotFoundException – If the key provided does not exist on the server.

Examples

Simple get operation:

bucket = cluster.bucket('travel-sample')
collection = bucket.scope('inventory').collection('airline')

res = await collection.get('airline_10')
print(f'Document value: {res.content_as[dict]}')

Simple get operation with options:

from datetime import timedelta
from acouchbase.options import GetOptions

# ... other code ...

res = await collection.get('airline_10', GetOptions(timeout=timedelta(seconds=2)))
print(f'Document value: {res.content_as[dict]}')
async get_all_replicas(key: str, opts: GetAllReplicasOptions | None = None, **kwargs: Unpack[GetAllReplicasOptionsKwargs]) → Iterable[GetReplicaResult]

Retrieves the value of a document from the collection returning both active and all available replicas.

Parameters:
  • key (str) – The key for the document to retrieve.

  • opts (GetAllReplicasOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used in place or to override provided GetAllReplicasOptions

Returns:

A stream of GetReplicaResult representing both active and replicas of the document retrieved.

Return type:

Iterable[GetReplicaResult]

Raises:

DocumentNotFoundException – If the key provided does not exist on the server.

Examples

Simple get_all_replicas operation:

bucket = cluster.bucket('travel-sample')
collection = bucket.scope('inventory').collection('airline')

result = await collection.get_all_replicas('airline_10')
for res in results:
    print(f'Document is replica: {res.is_replica}')
    print(f'Document value: {res.content_as[dict]}')

Simple get_all_replicas operation with options:

from datetime import timedelta
from acouchbase.options import GetAllReplicasOptions

# ... other code ...

result = await collection.get_all_replicas('airline_10',
                                            GetAllReplicasOptions(timeout=timedelta(seconds=10)))
for res in result:
    print(f'Document is replica: {res.is_replica}')
    print(f'Document value: {res.content_as[dict]}')

Stream get_all_replicas results:

from datetime import timedelta
from acouchbase.options import GetAllReplicasOptions

# ... other code ...

result = await collection.get_all_replicas('airline_10',
                                            GetAllReplicasOptions(timeout=timedelta(seconds=10)))
while True:
    try:
        res = next(result)
        print(f'Document is replica: {res.is_replica}')
        print(f'Document value: {res.content_as[dict]}')
    except StopIteration:
        print('Done streaming replicas.')
        break
async get_and_lock(key: str, lock_time: timedelta, opts: GetAndLockOptions | None = None, **kwargs: Unpack[GetAndLockOptionsKwargs]) → GetResult

Locks a document and retrieves the value of that document at the time it is locked.

Parameters:
  • key (str) – The key for the document to lock and retrieve.

  • lock_time (timedelta) – The amount of time to lock the document.

  • opts (GetAndLockOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used in place or to override provided GetAndLockOptions

Returns:

A future that contains an instance of GetResult if successful.

Return type:

Awaitable[GetResult]

Raises:

DocumentNotFoundException – If the key provided does not exist on the server.

Examples

Simple get and lock operation:

from datetime import timedelta

# ... other code ...

bucket = cluster.bucket('travel-sample')
collection = bucket.scope('inventory').collection('airline')

key = 'airline_10'
res = await collection.get_and_lock(key, timedelta(seconds=20))
print(f'Locked document: {res.content_as[dict]}')

Simple get and lock operation with options:

from datetime import timedelta
from acouchbase.options import GetAndLockOptions

# ... other code ...

key = 'airline_10'
res = await collection.get_and_lock(key,
                            timedelta(seconds=20),
                            GetAndLockOptions(timeout=timedelta(seconds=2)))
print(f'Locked document: {res.content_as[dict]}')
async get_and_touch(key: str, expiry: timedelta, opts: GetAndTouchOptions | None = None, **kwargs: Unpack[GetAndTouchOptionsKwargs]) → GetResult

Retrieves the value of the document and simultanously updates the expiry time for the same document.

Parameters:
  • key (str) – The key for the document retrieve and set expiry time.

  • expiry (timedelta) – The new expiry to apply to the document.

  • opts (GetAndTouchOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used in place or to override provided GetAndTouchOptions

Returns:

A future that contains an instance of GetResult if successful.

Return type:

Awaitable[GetResult]

Raises:

DocumentNotFoundException – If the key provided does not exist on the server.

Examples

Simple get and touch operation:

from datetime import timedelta

# ... other code ...

bucket = cluster.bucket('travel-sample')
collection = bucket.scope('inventory').collection('airline')

key = 'airline_10'
res = await collection.get_and_touch(key, timedelta(seconds=20))
print(f'Document w/ updated expiry: {res.content_as[dict]}')

Simple get and touch operation with options:

from datetime import timedelta
from acouchbase.options import GetAndTouchOptions

# ... other code ...

key = 'airline_10'
res = await collection.get_and_touch(key,
                            timedelta(seconds=20),
                            GetAndTouchOptions(timeout=timedelta(seconds=2)))
print(f'Document w/ updated expiry: {res.content_as[dict]}')
async get_any_replica(key: str, opts: GetAnyReplicaOptions | None = None, **kwargs: Unpack[GetAnyReplicaOptionsKwargs]) → GetReplicaResult

Retrieves a document from whichever of the active copy and the replicas answers first.

Parameters:
  • key (str) – The key for the document to retrieve.

  • opts (GetAnyReplicaOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used in place or to override provided GetAnyReplicaOptions

Returns:

An instance of GetReplicaResult.

Return type:

GetReplicaResult

Raises:

DocumentUnretrievableException – If the key provided does not exist on the server.

Examples

Simple get_any_replica operation:

bucket = cluster.bucket('travel-sample')
collection = bucket.scope('inventory').collection('airline')

res = await collection.get_any_replica('airline_10')
print(f'Document is replica: {res.is_replica}')
print(f'Document value: {res.content_as[dict]}')

Simple get_any_replica operation with options:

from datetime import timedelta
from acouchbase.options import GetAnyReplicaOptions

# ... other code ...

res = await collection.get_any_replica('airline_10',
                                        GetAnyReplicaOptions(timeout=timedelta(seconds=5)))
print(f'Document is replica: {res.is_replica}')
print(f'Document value: {res.content_as[dict]}')
async get_replica(key: str, strategy: GetReplicaStrategy, opts: GetReplicaOptions | None = None, **kwargs: Unpack[GetReplicaOptionsKwargs]) → GetReplicaResult

Retrieves a document from the replica the strategy selects.

Parameters:
Returns:

An instance of GetReplicaResult.

Return type:

GetReplicaResult

Raises:

Examples

Read the first replica:

from acouchbase.replica_reads import GetReplicaStrategy, ReplicaIndex

# ... other code ...

res = await collection.get_replica('airline_10', GetReplicaStrategy.from_index(ReplicaIndex.FIRST))
print(f'Document value: {res.content_as[dict]}')
async insert(key: str, value: Any, opts: InsertOptions | None = None, **kwargs: Unpack[InsertOptionsKwargs]) → MutationResult

Inserts a new document to the collection, failing if the document already exists.

Parameters:
  • key (str) – Document key to insert.

  • value (DocumentValue) – The value of the document to insert.

  • opts (InsertOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used in place or to override provided InsertOptions

Returns:

A future that contains an instance of MutationResult if successful.

Return type:

Awaitable[MutationResult]

Raises:

DocumentExistsException – If the document already exists on the server.

Examples

Simple insert operation:

bucket = cluster.bucket('travel-sample')
collection = bucket.scope('inventory').collection('airline')

key = 'airline_8091'
airline = {
    "type": "airline",
    "id": 8091,
    "callsign": "CBS",
    "iata": None,
    "icao": None,
    "name": "Couchbase Airways",
}
res = await collection.insert(key, doc)

Simple insert operation with options:

from acouchbase.durability import DurabilityLevel, ServerDurability
from acouchbase.options import InsertOptions

# ... other code ...

key = 'airline_8091'
airline = {
    "type": "airline",
    "id": 8091,
    "callsign": "CBS",
    "iata": None,
    "icao": None,
    "name": "Couchbase Airways",
}
durability = ServerDurability(level=DurabilityLevel.PERSIST_TO_MAJORITY)
res = await collection.insert(key, doc, InsertOptions(durability=durability))
async lookup_in(key: str, spec: Iterable[Spec], opts: LookupInOptions | None = None, **kwargs: Unpack[LookupInOptionsKwargs]) → LookupInResult

Fetches individual fields of a document, or information about them.

Parameters:
  • key (str) – The key for the document look in.

  • spec (Iterable[Spec]) – A list of specs describing the data to fetch from the document.

  • opts (LookupInOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used in place or to override provided LookupInOptions

Returns:

A future that contains an instance of LookupInResult if successful.

Return type:

Awaitable[LookupInResult]

Raises:

DocumentNotFoundException – If the key provided does not exist on the server.

Examples

Simple look-up in operation:

import couchbase.subdocument as SD

# ... other code ...

bucket = cluster.bucket('travel-sample')
collection = bucket.scope('inventory').collection('hotel')

key = 'hotel_10025'
res = await collection.lookup_in(key, (SD.get("geo"),))
print(f'Hotel {key} coordinates: {res.content_as[dict](0)}')

Simple look-up in operation with options:

from datetime import timedelta

import couchbase.subdocument as SD
from acouchbase.options import LookupInOptions

# ... other code ...

key = 'hotel_10025'
res = await collection.lookup_in(key,
                            (SD.get("geo"),),
                            LookupInOptions(timeout=timedelta(seconds=2)))
print(f'Hotel {key} coordinates: {res.content_as[dict](0)}')
async lookup_in_all_replicas(key: str, spec: Iterable[Spec], opts: LookupInAllReplicasOptions | None = None, **kwargs: Unpack[LookupInAllReplicasOptionsKwargs]) → Iterable[LookupInReplicaResult]

Fetches fields of a document from the active copy and every available replica.

Parameters:
  • key (str) – The key for the document look in.

  • spec (Iterable[Spec]) – A list of specs describing the data to fetch from the document.

  • opts (LookupInAllReplicasOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used in place or to override provided LookupInAllReplicasOptions

Returns:

A stream of LookupInReplicaResult representing both active and replicas of the sub-document retrieved.

Return type:

Iterable[LookupInReplicaResult]

Raises:

DocumentNotFoundException – If the key provided does not exist on the server.

Examples

Simple lookup_in_all_replicas operation:

import couchbase.subdocument as SD

# ... other code ...

bucket = cluster.bucket('travel-sample')
collection = bucket.scope('inventory').collection('hotel')

key = 'hotel_10025'
results = await collection.lookup_in_all_replicas(key, (SD.get("geo"),))
for res in results:
    print(f'Document is replica: {res.is_replica}')
    print(f'Hotel {key} coordinates: {res.content_as[dict](0)}')

Simple lookup_in_all_replicas operation with options:

import couchbase.subdocument as SD
from datetime import timedelta
from acouchbase.options import LookupInAllReplicasOptions

# ... other code ...

key = 'hotel_10025'
opts = LookupInAllReplicasOptions(timeout=timedelta(seconds=2))
results = await collection.lookup_in_all_replicas(key, (SD.get("geo"),), opts)

for res in results:
    print(f'Document is replica: {res.is_replica}')
    print(f'Hotel {key} coordinates: {res.content_as[dict](0)}')

Stream lookup_in_all_replicas results:

from datetime import timedelta
from acouchbase.options import GetAllReplicasOptions

# ... other code ...

key = 'hotel_10025'
opts = LookupInAllReplicasOptions(timeout=timedelta(seconds=2))
results = await collection.lookup_in_all_replicas(key, (SD.get("geo"),), opts)
while True:
    try:
        res = next(results)
        print(f'Document is replica: {res.is_replica}')
        print(f'Hotel {key} coordinates: {res.content_as[dict](0)}')
    except StopIteration:
        print('Done streaming replicas.')
        break
async lookup_in_any_replica(key: str, spec: Iterable[Spec], opts: LookupInAnyReplicaOptions | None = None, **kwargs: Unpack[LookupInAnyReplicaOptionsKwargs]) → LookupInReplicaResult

Fetches fields of a document from whichever of the active copy and the replicas answers first.

Parameters:
  • key (str) – The key for the document look in.

  • spec (Iterable[Spec]) – A list of specs describing the data to fetch from the document.

  • opts (LookupInAnyReplicaOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used in place or to override provided LookupInAnyReplicaOptions

Returns:

A future that contains an instance of LookupInReplicaResult if successful.

Return type:

Awaitable[LookupInReplicaResult]

Raises:

DocumentUnretrievableException – If the key provided does not exist on the server.

Examples

Simple lookup_in_any_replica operation:

import couchbase.subdocument as SD

# ... other code ...

bucket = cluster.bucket('travel-sample')
collection = bucket.scope('inventory').collection('hotel')

key = 'hotel_10025'
res = await collection.lookup_in_any_replica(key, (SD.get("geo"),))
print(f'Hotel {key} coordinates: {res.content_as[dict](0)}')

Simple lookup_in_any_replica operation with options:

from datetime import timedelta

import couchbase.subdocument as SD
from acouchbase.options import LookupInAnyReplicaOptions

# ... other code ...

key = 'hotel_10025'
res = await collection.lookup_in_any_replica(key,
                                             (SD.get("geo"),),
                                             LookupInAnyReplicaOptions(timeout=timedelta(seconds=2)))
print(f'Document is replica: {res.is_replica}')
print(f'Hotel {key} coordinates: {res.content_as[dict](0)}')
async mutate_in(key: str, spec: Iterable[Spec], opts: MutateInOptions | None = None, **kwargs: Unpack[MutateInOptionsKwargs]) → MutateInResult

Atomically modifies individual fields of a document.

The fields may include the document’s extended attributes (xattrs).

Parameters:
  • key (str) – The key for the document look in.

  • spec (Iterable[Spec]) – A list of specs describing the operations to perform on the document.

  • opts (MutateInOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used in place or to override provided MutateInOptions

Returns:

A future that contains an instance of MutateInResult if successful.

Return type:

Awaitable[MutateInResult]

Raises:

DocumentNotFoundException – If the key provided does not exist on the server.

Examples

Simple mutate-in operation:

import couchbase.subdocument as SD

# ... other code ...

bucket = cluster.bucket('travel-sample')
collection = bucket.scope('inventory').collection('hotel')

key = 'hotel_10025'
res = await collection.mutate_in(key, (SD.replace("city", "New City"),))

Simple mutate-in operation with options:

from datetime import timedelta

import couchbase.subdocument as SD
from acouchbase.options import MutateInOptions

# ... other code ...

key = 'hotel_10025'
res = await collection.mutate_in(key,
                            (SD.replace("city", "New City"),),
                            MutateInOptions(timeout=timedelta(seconds=2)))
property name: str

The name of this collection.

query_indexes() → CollectionQueryIndexManager

Get a manager for the query indexes of this collection.

Returns:

A CollectionQueryIndexManager instance.

Return type:

CollectionQueryIndexManager

async remove(key: str, opts: RemoveOptions | None = None, **kwargs: Unpack[RemoveOptionsKwargs]) → MutationResult

Removes an existing document. Failing if the document does not exist.

Parameters:
  • key (str) – Key for the document to remove.

  • opts (RemoveOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used in place or to override provided RemoveOptions

Returns:

A future that contains an instance of MutationResult if successful.

Return type:

Awaitable[MutationResult]

Raises:

DocumentNotFoundException – If the document does not exist on the server.

Examples

Simple remove operation:

bucket = cluster.bucket('travel-sample')
collection = bucket.scope('inventory').collection('airline')

res = collection.remove('airline_10')

Simple remove operation with options:

from acouchbase.durability import DurabilityLevel, ServerDurability
from acouchbase.options import RemoveOptions

# ... other code ...

durability = ServerDurability(level=DurabilityLevel.MAJORITY)
res = collection.remove('airline_10', RemoveOptions(durability=durability))
async replace(key: str, value: Any, opts: ReplaceOptions | None = None, **kwargs: Unpack[ReplaceOptionsKwargs]) → MutationResult

Replaces the value of an existing document. Failing if the document does not exist.

Parameters:
  • key (str) – Document key to replace.

  • value (DocumentValue) – The value of the document to replace.

  • opts (ReplaceOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used in place or to override provided ReplaceOptions

Returns:

A future that contains an instance of MutationResult if successful.

Return type:

Awaitable[MutationResult]

Raises:

DocumentNotFoundException – If the document does not exist on the server.

Examples

Simple replace operation:

bucket = cluster.bucket('travel-sample')
collection = bucket.scope('inventory').collection('airline')

key = 'airline_8091'
res = await collection.get(key)
content = res.content_as[dict]
airline["name"] = "Couchbase Airways!!"
res = await collection.replace(key, doc)

Simple replace operation with options:

from acouchbase.durability import DurabilityLevel, ServerDurability
from acouchbase.options import ReplaceOptions

# ... other code ...

key = 'airline_8091'
res = await collection.get(key)
content = res.content_as[dict]
airline["name"] = "Couchbase Airways!!"
durability = ServerDurability(level=DurabilityLevel.MAJORITY)
res = await collection.replace(key, doc, InsertOptions(durability=durability))
scan(scan_type: ScanType, opts: ScanOptions | None = None, **kwargs: Unpack[ScanOptionsKwargs]) → AsyncScanResultIterable

Execute a key-value range scan operation from the collection.

Note

Use this API for low concurrency batch queries where latency is not a critical as the system may have to scan a lot of documents to find the matching documents. For low latency range queries, it is recommended that you use SQL++ with the necessary indexes.

Parameters:
Raises:
Returns:

An instance of AsyncScanResultIterable.

Return type:

AsyncScanResultIterable

Examples

Simple range scan operation:

from acouchbase.kv_range_scan import RangeScan
from acouchbase.options import ScanOptions

# ... other code ...

bucket = cluster.bucket('travel-sample')
collection = bucket.scope('inventory').collection('airline')

scan_type = RangeScan(ScanTerm('airline-00'), ScanTerm('airline-99'))
scan_iter = collection.scan(scan_type, ScanOptions(ids_only=True))

async for res in scan_iter:
    print(res)
async touch(key: str, expiry: timedelta, opts: TouchOptions | None = None, **kwargs: Unpack[TouchOptionsKwargs]) → MutationResult

Updates the expiry on an existing document.

Parameters:
  • key (str) – Key for the document to touch.

  • expiry (timedelta) – The new expiry for the document.

  • opts (TouchOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used in place or to override provided TouchOptions

Returns:

A future that contains an instance of MutationResult if successful.

Return type:

Awaitable[MutationResult]

Raises:

DocumentNotFoundException – If the document does not exist on the server.

Examples

Simple touch operation:

from datetime import timedelta

# ... other code ...

bucket = cluster.bucket('travel-sample')
collection = bucket.scope('inventory').collection('airline')

res = await collection.touch('airline_10', timedelta(seconds=300))

Simple touch operation with options:

from datetime import timedelta

from acouchbase.options import TouchOptions

# ... other code ...

res = await collection.touch('airline_10',
                        timedelta(seconds=300),
                        TouchOptions(timeout=timedelta(seconds=2)))
async unlock(key: str, cas: int, opts: UnlockOptions | None = None, **kwargs: Unpack[UnlockOptionsKwargs]) → None

Unlocks a previously locked document.

Parameters:
  • key (str) – The key for the document to unlock.

  • cas (int) – The CAS of the document, used to validate lock ownership.

  • opts (UnlockOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used in place or to override provided UnlockOptions

Returns:

A future that contains an empty result if successful.

Return type:

Awaitable[None]

Raises:

Examples

Simple unlock operation:

from datetime import timedelta

# ... other code ...

bucket = cluster.bucket('travel-sample')
collection = bucket.scope('inventory').collection('airline')

key = 'airline_10'
res = await collection.get_and_lock(key, timedelta(seconds=5))
await collection.unlock(key, res.cas)
# this should be okay once document is unlocked
await collection.upsert(key, res.content_as[dict])
async upsert(key: str, value: Any, opts: UpsertOptions | None = None, **kwargs: Unpack[UpsertOptionsKwargs]) → MutationResult

Upserts a document to the collection. This operation succeeds whether or not the document already exists.

Parameters:
  • key (str) – Document key to upsert.

  • value (DocumentValue) – The value of the document to upsert.

  • opts (UpsertOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used in place or to override provided UpsertOptions

Returns:

A future that contains an instance of MutationResult if successful.

Return type:

Awaitable[MutationResult]

Examples

Simple upsert operation:

bucket = cluster.bucket('travel-sample')
collection = bucket.scope('inventory').collection('airline')

key = 'airline_8091'
airline = {
    "type": "airline",
    "id": 8091,
    "callsign": "CBS",
    "iata": None,
    "icao": None,
    "name": "Couchbase Airways",
}
res = await collection.upsert(key, doc)

Simple upsert operation with options:

from acouchbase.durability import DurabilityLevel, ServerDurability
from acouchbase.options import UpsertOptions

# ... other code ...

key = 'airline_8091'
airline = {
    "type": "airline",
    "id": 8091,
    "callsign": "CBS",
    "iata": None,
    "icao": None,
    "name": "Couchbase Airways",
}
durability = ServerDurability(level=DurabilityLevel.MAJORITY)
res = await collection.upsert(key, doc, InsertOptions(durability=durability))
acouchbase.collection.Collection

alias of AsyncCollection