class Collection extends AnyRef
Provides blocking, synchronous access to all collection APIs. This is the main entry-point for key-value (KV) operations.
If asynchronous access is needed, we recommend looking at the AsyncCollection which is built around
returning Future
s, or the ReactiveCollection which provides a reactive programming API.
This blocking API itself is just a small layer on top of the AsyncCollection which blocks the current thread until the request completes with a response.
- Since
1.0.0
- Alphabetic
- By Inheritance
- Collection
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new Collection(async: AsyncCollection, bucketName: String)
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- val async: AsyncCollection
- val binary: BinaryCollection
Provides access to less-commonly used methods.
- val bucketName: String
- def buffer[T](id: String, options: Option[CouchbaseCollectionOptions] = None)(implicit decode: JsonDeserializer[T], encode: JsonSerializer[T], tag: ClassTag[T]): CouchbaseBuffer[T]
Returns a com.couchbase.client.scala.datastructures.CouchbaseBuffer backed by this collection.
Returns a com.couchbase.client.scala.datastructures.CouchbaseBuffer backed by this collection.
- id
id of the document underyling the datastructure
- options
options for controlling the behaviour of the datastructure
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @IntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def exists(id: String, options: ExistsOptions): Try[ExistsResult]
Checks if a document exists.
Checks if a document exists.
This doesn't fetch the document so if the application simply needs to know if the document exists, this is the most efficient method.
- id
the unique identifier of the document
- options
configure options that affect this operation
- returns
on success, a
Success(GetResult)
, else aFailure(CouchbaseException)
. This could becom .couchbase.client.core.error.DocumentDoesNotExistException
, indicating the document could not be found. anyscala.util.control.NonFatal
error returned will derive ultimately fromcom.couchbase.client.core.error.CouchbaseException
. See the error handling docs for more detail.
- def exists(id: String, timeout: Duration = kvReadTimeout): Try[ExistsResult]
Checks if a document exists.
Checks if a document exists.
This doesn't fetch the document so if the application simply needs to know if the document exists, this is the most efficient method.
This overload provides only the most commonly used options. If you need to configure something more esoteric, use the overload that takes an com.couchbase.client.scala.kv.ExistsOptions instead, which supports all available options.
- id
the unique identifier of the document
- timeout
when the operation will timeout. This will default to
timeoutConfig().kvTimeout()
in the provided com.couchbase.client.scala.env.ClusterEnvironment.- returns
on success, a
Success(GetResult)
, else aFailure(CouchbaseException)
. This could becom .couchbase.client.core.error.DocumentDoesNotExistException
, indicating the document could not be found. anyscala.util.control.NonFatal
error returned will derive ultimately fromcom.couchbase.client.core.error.CouchbaseException
. See the error handling docs for more detail.
- def get(id: String, options: GetOptions): Try[GetResult]
Fetches a full document from this collection.
Fetches a full document from this collection.
- id
the unique identifier of the document
- options
configure options that affect this operation
- returns
on success, a
Success(GetResult)
, else aFailure(CouchbaseException)
. This could becom .couchbase.client.core.error.DocumentDoesNotExistException
, indicating the document could not be found. anyscala.util.control.NonFatal
error returned will derive ultimately fromcom.couchbase.client.core.error.CouchbaseException
. See the error handling docs for more detail.
- def get(id: String, timeout: Duration = kvReadTimeout): Try[GetResult]
Fetches a full document from this collection.
Fetches a full document from this collection.
This overload provides only the most commonly used options. If you need to configure something more esoteric, use the overload that takes an com.couchbase.client.scala.kv.GetOptions instead, which supports all available options.
- id
the unique identifier of the document
- timeout
when the operation will timeout. This will default to
timeoutConfig().kvTimeout()
in the provided com.couchbase.client.scala.env.ClusterEnvironment.- returns
on success, a
Success(GetResult)
, else aFailure(CouchbaseException)
. This could becom .couchbase.client.core.error.DocumentDoesNotExistException
, indicating the document could not be found. anyscala.util.control.NonFatal
error returned will derive ultimately fromcom.couchbase.client.core.error.CouchbaseException
. See the error handling docs for more detail.
- def getAllReplicas(id: String, options: GetAllReplicasOptions): Iterable[GetReplicaResult]
Retrieves all available versions of the document.
Retrieves all available versions of the document.
The application should default to using
.get()
instead. This method is intended for advanced scenarios, including where a particular write has ambiguously failed (e.g. it may or may not have succeeded), and the application wants to attempt manual verification and resolution.The returned Iterable
will block on each call to
nextuntil the next replica has responded.
- id
the unique identifier of the document
- options
configure options that affect this operation
- returns
on success, a
Success(GetResult)
, else aFailure(CouchbaseException)
. This could becom.couchbase.client.core.error.DocumentDoesNotExistException
, indicating the document could not be found. anyscala.util.control.NonFatal
error returned will derive ultimately fromcom.couchbase.client.core.error.CouchbaseException
. See the error handling docs for more detail.
- def getAllReplicas(id: String, timeout: Duration = kvReadTimeout): Iterable[GetReplicaResult]
Retrieves all available versions of the document.
Retrieves all available versions of the document.
The application should default to using
.get()
instead. This method is intended for advanced scenarios, including where a particular write has ambiguously failed (e.g. it may or may not have succeeded), and the application wants to attempt manual verification and resolution.The returned
Iterable
will block on each call tonext
until the next replica has responded.This overload provides only the most commonly used options. If you need to configure something more esoteric, use the overload that takes an com.couchbase.client.scala.kv.GetAllReplicasOptions instead, which supports all available options.
- id
the unique identifier of the document
- timeout
when the operation will timeout. This will default to
timeoutConfig().kvTimeout()
in the provided com.couchbase.client.scala.env.ClusterEnvironment.- returns
on success, a
Success(GetResult)
, else aFailure(CouchbaseException)
. This could becom.couchbase.client.core.error.DocumentDoesNotExistException
, indicating the document could not be found. anyscala.util.control.NonFatal
error returned will derive ultimately fromcom.couchbase.client.core.error.CouchbaseException
. See the error handling docs for more detail.
- def getAndLock(id: String, lockTime: Duration, options: GetAndLockOptions): Try[GetResult]
Fetches a full document from this collection, and simultaneously lock the document from writes.
Fetches a full document from this collection, and simultaneously lock the document from writes.
The CAS value returned in the kv.GetResult is the document's 'key': during the locked period, the document may only be modified by providing this CAS.
- id
the unique identifier of the document
- lockTime
how long to lock the document for
- options
configure options that affect this operation
- returns
on success, a Success(GetResult)
, else a
Failure(CouchbaseException). This could be
com .couchbase.client.core.error.DocumentDoesNotExistException, indicating the document could not be found. any
scala.util.control.NonFatalerror returned will derive ultimately from
com.couchbase.client.core.error.CouchbaseException. See the error handling docs for more detail.
- def getAndLock(id: String, lockTime: Duration, timeout: Duration = kvReadTimeout): Try[GetResult]
Fetches a full document from this collection, and simultaneously lock the document from writes.
Fetches a full document from this collection, and simultaneously lock the document from writes.
The CAS value returned in the kv.GetResult is the document's 'key': during the locked period, the document may only be modified by providing this CAS.
This overload provides only the most commonly used options. If you need to configure something more esoteric, use the overload that takes an com.couchbase.client.scala.kv.GetAndLockOptions instead, which supports all available options.
- id
the unique identifier of the document
- lockTime
how long to lock the document for
- timeout
when the operation will timeout. This will default to
timeoutConfig().kvTimeout()
in the provided com.couchbase.client.scala.env.ClusterEnvironment.- returns
on success, a Success(GetResult)
, else a
Failure(CouchbaseException). This could be
com .couchbase.client.core.error.DocumentDoesNotExistException, indicating the document could not be found. any
scala.util.control.NonFatalerror returned will derive ultimately from
com.couchbase.client.core.error.CouchbaseException. See the error handling docs for more detail.
- def getAndTouch(id: String, expiry: Duration, timeout: Duration = kvReadTimeout): Try[GetResult]
Fetches a full document from this collection, and simultaneously update the expiry value of the document.
Fetches a full document from this collection, and simultaneously update the expiry value of the document.
This overload provides only the most commonly used options. If you need to configure something more esoteric, use the overload that takes an com.couchbase.client.scala.kv.GetAndTouchOptions instead, which supports all available options.
- id
the unique identifier of the document
- expiry
Couchbase documents optionally can have an expiration field set, e.g. when they will automatically expire. On mutations if this is left at the default (0), then any expiry will be removed and the document will never expire. If the application wants to preserve expiration then they should use the
withExpiration
parameter on any gets, and provide the returned expiration parameter to any mutations.- timeout
when the operation will timeout. This will default to
timeoutConfig().kvTimeout()
in the provided com.couchbase.client.scala.env.ClusterEnvironment.- returns
on success, a Success(GetResult)
, else a
Failure(CouchbaseException). This could be
com .couchbase.client.core.error.DocumentDoesNotExistException, indicating the document could not be found. any
scala.util.control.NonFatalerror returned will derive ultimately from
com.couchbase.client.core.error.CouchbaseException. See the error handling docs for more detail.
- def getAndTouch(id: String, expiry: Duration, options: GetAndTouchOptions): Try[GetResult]
Fetches a full document from this collection, and simultaneously update the expiry value of the document.
Fetches a full document from this collection, and simultaneously update the expiry value of the document.
- id
the unique identifier of the document
- expiry
Couchbase documents optionally can have an expiration field set, e.g. when they will automatically expire. On mutations if this is left at the default (0), then any expiry will be removed and the document will never expire. If the application wants to preserve expiration then they should use the
withExpiration
parameter on any gets, and provide the returned expiration parameter to any mutations.- options
configure options that affect this operation
- returns
on success, a Success(GetResult)
, else a
Failure(CouchbaseException). This could be
com .couchbase.client.core.error.DocumentDoesNotExistException, indicating the document could not be found. any
scala.util.control.NonFatalerror returned will derive ultimately from
com.couchbase.client.core.error.CouchbaseException. See the error handling docs for more detail.
- def getAnyReplica(id: String, options: GetAnyReplicaOptions): Try[GetReplicaResult]
Retrieves any available version of the document.
Retrieves any available version of the document.
The application should default to using
.get()
instead. This method is intended for high-availability situations where, say, a.get()
operation has failed, and the application wants to return any - even possibly stale - data as soon as possible.Under the hood this sends a request to all configured replicas for the document, including the active, and whichever returns first is returned.
- id
the unique identifier of the document
- options
configure options that affect this operation
- returns
on success, a
Success(GetResult)
, else aFailure(CouchbaseException)
. This could becom .couchbase.client.core.error.DocumentDoesNotExistException
, indicating the document could not be found. anyscala.util.control.NonFatal
error returned will derive ultimately fromcom.couchbase.client.core.error.CouchbaseException
. See the error handling docs for more detail.
- def getAnyReplica(id: String, timeout: Duration = kvReadTimeout): Try[GetReplicaResult]
Retrieves any available version of the document.
Retrieves any available version of the document.
The application should default to using
.get()
instead. This method is intended for high-availability situations where, say, a.get()
operation has failed, and the application wants to return any - even possibly stale - data as soon as possible.Under the hood this sends a request to all configured replicas for the document, including the active, and whichever returns first is returned.
This overload provides only the most commonly used options. If you need to configure something more esoteric, use the overload that takes an com.couchbase.client.scala.kv.GetAnyReplicaOptions instead, which supports all available options.
- id
the unique identifier of the document
- timeout
when the operation will timeout. This will default to
timeoutConfig().kvTimeout()
in the provided com.couchbase.client.scala.env.ClusterEnvironment.- returns
on success, a
Success(GetResult)
, else aFailure(CouchbaseException)
. This could becom .couchbase.client.core.error.DocumentDoesNotExistException
, indicating the document could not be found. anyscala.util.control.NonFatal
error returned will derive ultimately fromcom.couchbase.client.core.error.CouchbaseException
. See the error handling docs for more detail.
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
- def insert[T](id: String, content: T, options: InsertOptions)(implicit serializer: JsonSerializer[T]): Try[MutationResult]
Inserts a full document into this collection, if it does not exist already.
Inserts a full document into this collection, if it does not exist already.
- id
the unique identifier of the document
- content
this can be of any type for which an implicit
com.couchbase.client.scala.codec.Conversions.JsonSerializer
can be found: a list of types that are supported 'out of the box' is available at these JSON docs- options
configure options that affect this operation
- returns
on success, a
Success(MutationResult)
, else aFailure(CouchbaseException)
. This could becom .couchbase.client.core.error.DocumentAlreadyExistsException
, indicating the document already exists. anyscala.util.control.NonFatal
error returned will derive ultimately fromcom.couchbase.client.core.error.CouchbaseException
. See the error handling docs for more detail.
- def insert[T](id: String, content: T, durability: Durability = Disabled, timeout: Duration = Duration.MinusInf)(implicit serializer: JsonSerializer[T]): Try[MutationResult]
Inserts a full document into this collection, if it does not exist already.
Inserts a full document into this collection, if it does not exist already.
This overload provides only the most commonly used options. If you need to configure something more esoteric, use the overload that takes an com.couchbase.client.scala.kv.InsertOptions instead, which supports all available options.
- id
the unique identifier of the document
- content
this can be of any type for which an implicit
com.couchbase.client.scala.codec.Conversions.JsonSerializer
can be found: a list of types that are supported 'out of the box' is available at these JSON docs- durability
writes in Couchbase are written to a single node, and from there the Couchbase Server will take care of sending that mutation to any configured replicas. This parameter provides some control over ensuring the success of the mutation's replication. See com.couchbase.client.scala.durability.Durability for a detailed discussion.
- timeout
when the operation will timeout. This will default to
timeoutConfig().kvTimeout()
in the provided com.couchbase.client.scala.env.ClusterEnvironment.- returns
on success, a
Success(MutationResult)
, else aFailure(CouchbaseException)
. This could becom .couchbase.client.core.error.DocumentAlreadyExistsException
, indicating the document already exists. anyscala.util.control.NonFatal
error returned will derive ultimately fromcom.couchbase.client.core.error.CouchbaseException
. See the error handling docs for more detail.
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def lookupIn(id: String, spec: Seq[LookupInSpec], options: LookupInOptions): Try[LookupInResult]
SubDocument lookups allow retrieving parts of a JSON document directly, which may be more efficient than retrieving the entire document.
SubDocument lookups allow retrieving parts of a JSON document directly, which may be more efficient than retrieving the entire document.
Individual operations can succeed or fail without affecting the others. See kv.LookupInResult for details on how to process the results.
- id
the unique identifier of the document
- spec
a sequence of
LookupInSpec
specifying what fields to fetch. See kv.LookupInSpec for more details.- options
configure options that affect this operation
- returns
on success, a
Success(LookupInResult)
, else aFailure(CouchbaseException)
. This could becom.couchbase.client.core.error.DocumentDoesNotExistException
, indicating the document could not be found. anyscala.util.control.NonFatal
error returned will derive ultimately fromcom.couchbase.client.core.error.CouchbaseException
. See the error handling docs for more detail.
- def lookupIn(id: String, spec: Seq[LookupInSpec], timeout: Duration = kvReadTimeout): Try[LookupInResult]
SubDocument lookups allow retrieving parts of a JSON document directly, which may be more efficient than retrieving the entire document.
SubDocument lookups allow retrieving parts of a JSON document directly, which may be more efficient than retrieving the entire document.
Individual operations can succeed or fail without affecting the others. See kv.LookupInResult for details on how to process the results.
This overload provides only the most commonly used options. If you need to configure something more esoteric, use the overload that takes an com.couchbase.client.scala.kv.LookupInOptions instead, which supports all available options.
- id
the unique identifier of the document
- spec
a sequence of
LookupInSpec
specifying what fields to fetch. See kv.LookupInSpec for more details.- timeout
when the operation will timeout. This will default to
timeoutConfig().kvTimeout()
in the provided com.couchbase.client.scala.env.ClusterEnvironment.- returns
on success, a
Success(LookupInResult)
, else aFailure(CouchbaseException)
. This could becom.couchbase.client.core.error.DocumentDoesNotExistException
, indicating the document could not be found. anyscala.util.control.NonFatal
error returned will derive ultimately fromcom.couchbase.client.core.error.CouchbaseException
. See the error handling docs for more detail.
- def lookupInAllReplicas(id: String, spec: Seq[LookupInSpec], options: LookupInAllReplicasOptions): Try[Iterable[LookupInReplicaResult]]
SubDocument lookups allow retrieving parts of a JSON document directly, which may be more efficient than retrieving the entire document.
SubDocument lookups allow retrieving parts of a JSON document directly, which may be more efficient than retrieving the entire document.
Individual operations can succeed or fail without affecting the others. See kv.LookupInReplicaResult for details on how to process the results.
This variant will read and return all replicas of the document.
- id
the unique identifier of the document
- spec
a sequence of
LookupInSpec
specifying what fields to fetch. See kv.LookupInSpec for more details.- options
configure options that affect this operation
- returns
on success, a
Success(LookupInResult)
, else aFailure(CouchbaseException)
.
- Annotations
- @SinceCouchbase()
- def lookupInAllReplicas(id: String, spec: Seq[LookupInSpec], timeout: Duration = kvReadTimeout): Try[Iterable[LookupInReplicaResult]]
SubDocument lookups allow retrieving parts of a JSON document directly, which may be more efficient than retrieving the entire document.
SubDocument lookups allow retrieving parts of a JSON document directly, which may be more efficient than retrieving the entire document.
Individual operations can succeed or fail without affecting the others. See kv.LookupInReplicaResult for details on how to process the results.
This overload provides only the most commonly used options. If you need to configure something more esoteric, use the overload that takes an com.couchbase.client.scala.kv.LookupInAllReplicasOptions instead, which supports all available options.
This variant will read and return all replicas of the document.
- id
the unique identifier of the document
- spec
a sequence of
LookupInSpec
specifying what fields to fetch. See kv.LookupInSpec for more details.- timeout
when the operation will timeout. This will default to
timeoutConfig().kvTimeout()
in the provided com.couchbase.client.scala.env.ClusterEnvironment.- returns
on success, a
Success(LookupInResult)
, else aFailure(CouchbaseException)
.
- Annotations
- @SinceCouchbase()
- def lookupInAnyReplica(id: String, spec: Seq[LookupInSpec], options: LookupInAnyReplicaOptions): Try[LookupInReplicaResult]
SubDocument lookups allow retrieving parts of a JSON document directly, which may be more efficient than retrieving the entire document.
SubDocument lookups allow retrieving parts of a JSON document directly, which may be more efficient than retrieving the entire document.
Individual operations can succeed or fail without affecting the others. See kv.LookupInReplicaResult for details on how to process the results.
This variant will read all replicas of the document, and return the first one found.
- id
the unique identifier of the document
- spec
a sequence of
LookupInSpec
specifying what fields to fetch. See kv.LookupInSpec for more details.- options
configure options that affect this operation
- returns
on success, a
Success(LookupInResult)
, else aFailure(CouchbaseException)
.
- Annotations
- @SinceCouchbase()
- def lookupInAnyReplica(id: String, spec: Seq[LookupInSpec], timeout: Duration = kvReadTimeout): Try[LookupInReplicaResult]
SubDocument lookups allow retrieving parts of a JSON document directly, which may be more efficient than retrieving the entire document.
SubDocument lookups allow retrieving parts of a JSON document directly, which may be more efficient than retrieving the entire document.
Individual operations can succeed or fail without affecting the others. See kv.LookupInReplicaResult for details on how to process the results.
This variant will read all replicas of the document, and return the first one found.
This overload provides only the most commonly used options. If you need to configure something more esoteric, use the overload that takes an com.couchbase.client.scala.kv.LookupInAnyReplicaOptions instead, which supports all available options.
- id
the unique identifier of the document
- spec
a sequence of
LookupInSpec
specifying what fields to fetch. See kv.LookupInSpec for more details.- timeout
when the operation will timeout. This will default to
timeoutConfig().kvTimeout()
in the provided com.couchbase.client.scala.env.ClusterEnvironment.- returns
on success, a
Success(LookupInResult)
, else aFailure(CouchbaseException)
.
- Annotations
- @SinceCouchbase()
- def map[T](id: String, options: Option[CouchbaseCollectionOptions] = None)(implicit decode: JsonDeserializer[T], encode: JsonSerializer[T], tag: ClassTag[T]): CouchbaseMap[T]
Returns a com.couchbase.client.scala.datastructures.CouchbaseMap backed by this collection.
Returns a com.couchbase.client.scala.datastructures.CouchbaseMap backed by this collection.
- id
id of the document underyling the datastructure
- options
options for controlling the behaviour of the datastructure
- def mutateIn(id: String, spec: Seq[MutateInSpec], options: MutateInOptions): Try[MutateInResult]
Sub-Document mutations allow modifying parts of a JSON document directly, which can be more efficiently than fetching and modifying the full document.
Sub-Document mutations allow modifying parts of a JSON document directly, which can be more efficiently than fetching and modifying the full document.
Mutations are all-or-nothing: if one fails, then no mutation will be performed.
- id
the unique identifier of the document
- spec
a sequence of
MutateInSpec
specifying what mutations to apply to the document. See com.couchbase.client.scala.kv.MutateInSpec for more details.- options
configure options that affect this operation
- returns
on success, a
Success(MutateInResult)
, else aFailure(CouchbaseException)
. This could becom .couchbase.client.core.error.DocumentDoesNotExistException
, indicating the document could not be found. anyscala.util.control.NonFatal
error returned will derive ultimately fromcom.couchbase.client.core.error.CouchbaseException
. See the error handling docs for more detail.
- def mutateIn(id: String, spec: Seq[MutateInSpec], cas: Long = 0, document: StoreSemantics = StoreSemantics.Replace, durability: Durability = Disabled, timeout: Duration = Duration.MinusInf): Try[MutateInResult]
Sub-Document mutations allow modifying parts of a JSON document directly, which can be more efficiently than fetching and modifying the full document.
Sub-Document mutations allow modifying parts of a JSON document directly, which can be more efficiently than fetching and modifying the full document.
Mutations are all-or-nothing: if one fails, then no mutation will be performed.
This overload provides only the most commonly used options. If you need to configure something more esoteric, use the overload that takes an com.couchbase.client.scala.kv.MutateInOptions instead, which supports all available options.
- id
the unique identifier of the document
- spec
a sequence of
MutateInSpec
specifying what mutations to apply to the document. See com.couchbase.client.scala.kv.MutateInSpec for more details.- cas
Couchbase documents all have a CAS (Compare-And-Set) field, a simple integer that allows optimistic concurrency - e.g. it can detect if another agent has modified a document in-between this agent getting and modifying the document. The default is 0, which disables CAS checking.
- document
controls whether the document should be inserted, upserted, or not touched. See com.couchbase.client.scala.kv.StoreSemantics for details.
- durability
writes in Couchbase are written to a single node, and from there the Couchbase Server will take care of sending that mutation to any configured replicas. This parameter provides some control over ensuring the success of the mutation's replication. See com.couchbase.client.scala.durability.Durability for a detailed discussion.
- timeout
when the operation will timeout. This will default to
timeoutConfig().kvTimeout()
in the provided com.couchbase.client.scala.env.ClusterEnvironment.- returns
on success, a
Success(MutateInResult)
, else aFailure(CouchbaseException)
. This could becom .couchbase.client.core.error.DocumentDoesNotExistException
, indicating the document could not be found. anyscala.util.control.NonFatal
error returned will derive ultimately fromcom.couchbase.client.core.error.CouchbaseException
. See the error handling docs for more detail.
- def name: String
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- lazy val queryIndexes: CollectionQueryIndexManager
Manage query indexes for this collection
- def queue[T](id: String, options: Option[CouchbaseCollectionOptions] = None)(implicit decode: JsonDeserializer[T], encode: JsonSerializer[T], tag: ClassTag[T]): CouchbaseQueue[T]
Returns a com.couchbase.client.scala.datastructures.CouchbaseQueue backed by this collection.
Returns a com.couchbase.client.scala.datastructures.CouchbaseQueue backed by this collection.
- id
id of the document underyling the datastructure
- options
options for controlling the behaviour of the datastructure
- val reactive: ReactiveCollection
Provides access to a reactive-programming version of this API.
- def remove(id: String, options: RemoveOptions): Try[MutationResult]
Removes a document from this collection, if it exists.
Removes a document from this collection, if it exists.
- id
the unique identifier of the document
- options
configure options that affect this operation
- returns
on success, a
Success(MutationResult)
, else aFailure(CouchbaseException)
. This could becom .couchbase.client.core.error.DocumentDoesNotExistException
, indicating the document could not be found. anyscala.util.control.NonFatal
error returned will derive ultimately fromcom.couchbase.client.core.error.CouchbaseException
. See the error handling docs for more detail.
- def remove(id: String, cas: Long = 0, durability: Durability = Disabled, timeout: Duration = Duration.MinusInf): Try[MutationResult]
Removes a document from this collection, if it exists.
Removes a document from this collection, if it exists.
This overload provides only the most commonly used options. If you need to configure something more esoteric, use the overload that takes an com.couchbase.client.scala.kv.RemoveOptions instead, which supports all available options.
- id
the unique identifier of the document
- cas
Couchbase documents all have a CAS (Compare-And-Set) field, a simple integer that allows optimistic concurrency - e.g. it can detect if another agent has modified a document in-between this agent getting and modifying the document. The default is 0, which disables CAS checking.
- durability
writes in Couchbase are written to a single node, and from there the Couchbase Server will take care of sending that mutation to any configured replicas. This parameter provides some control over ensuring the success of the mutation's replication. See com.couchbase.client.scala.durability.Durability for a detailed discussion.
- timeout
when the operation will timeout. This will default to
timeoutConfig().kvTimeout()
in the provided com.couchbase.client.scala.env.ClusterEnvironment.- returns
on success, a
Success(MutationResult)
, else aFailure(CouchbaseException)
. This could becom .couchbase.client.core.error.DocumentDoesNotExistException
, indicating the document could not be found. anyscala.util.control.NonFatal
error returned will derive ultimately fromcom.couchbase.client.core.error.CouchbaseException
. See the error handling docs for more detail.
- def replace[T](id: String, content: T, options: ReplaceOptions)(implicit serializer: JsonSerializer[T]): Try[MutationResult]
Replaces the contents of a full document in this collection, if it already exists.
Replaces the contents of a full document in this collection, if it already exists.
- id
the unique identifier of the document
- content
this can be of any type for which an implicit
com.couchbase.client.scala.codec.Conversions.JsonSerializer
can be found: a list of types that are supported 'out of the box' is available at these JSON docs- options
configure options that affect this operation
- returns
on success, a
Success(MutationResult)
, else aFailure(CouchbaseException)
. This could becom .couchbase.client.core.error.DocumentDoesNotExistException
, indicating the document could not be found. anyscala.util.control.NonFatal
error returned will derive ultimately fromcom.couchbase.client.core.error.CouchbaseException
. See the error handling docs for more detail.
- def replace[T](id: String, content: T, cas: Long = 0, durability: Durability = Disabled, timeout: Duration = Duration.MinusInf)(implicit serializer: JsonSerializer[T]): Try[MutationResult]
Replaces the contents of a full document in this collection, if it already exists.
Replaces the contents of a full document in this collection, if it already exists.
This overload provides only the most commonly used options. If you need to configure something more esoteric, use the overload that takes an com.couchbase.client.scala.kv.ReplaceOptions instead, which supports all available options.
- id
the unique identifier of the document
- content
this can be of any type for which an implicit
com.couchbase.client.scala.codec.Conversions.JsonSerializer
can be found: a list of types that are supported 'out of the box' is available at these JSON docs- cas
Couchbase documents all have a CAS (Compare-And-Set) field, a simple integer that allows optimistic concurrency - e.g. it can detect if another agent has modified a document in-between this agent getting and modifying the document. The default is 0, which disables CAS checking.
- durability
writes in Couchbase are written to a single node, and from there the Couchbase Server will take care of sending that mutation to any configured replicas. This parameter provides some control over ensuring the success of the mutation's replication. See com.couchbase.client.scala.durability.Durability for a detailed discussion.
- timeout
when the operation will timeout. This will default to
timeoutConfig().kvTimeout()
in the provided com.couchbase.client.scala.env.ClusterEnvironment.- returns
on success, a
Success(MutationResult)
, else aFailure(CouchbaseException)
. This could becom .couchbase.client.core.error.DocumentDoesNotExistException
, indicating the document could not be found. anyscala.util.control.NonFatal
error returned will derive ultimately fromcom.couchbase.client.core.error.CouchbaseException
. See the error handling docs for more detail.
- def scan(scanType: ScanType, opts: ScanOptions): Try[Iterator[ScanResult]]
Initiates a KV range scan, which will return a non-blocking stream of KV documents.
Initiates a KV range scan, which will return a non-blocking stream of KV documents.
CAVEAT:This method is suitable for use cases that require relatively low concurrency and tolerate relatively high latency. If your application does many scans at once, or requires low latency results, we recommend using SQL++ (with a primary index on the collection) instead.
- Annotations
- @SinceCouchbase()
- def scan(scanType: ScanType): Try[Iterator[ScanResult]]
Initiates a KV range scan, which will return a non-blocking stream of KV documents.
Initiates a KV range scan, which will return a non-blocking stream of KV documents.
Uses default options.
CAVEAT:This method is suitable for use cases that require relatively low concurrency and tolerate relatively high latency. If your application does many scans at once, or requires low latency results, we recommend using SQL++ (with a primary index on the collection) instead.
- Annotations
- @SinceCouchbase()
- def scopeName: String
- def set[T](id: String, options: Option[CouchbaseCollectionOptions] = None)(implicit decode: JsonDeserializer[T], encode: JsonSerializer[T]): CouchbaseSet[T]
Returns a com.couchbase.client.scala.datastructures.CouchbaseSet backed by this collection.
Returns a com.couchbase.client.scala.datastructures.CouchbaseSet backed by this collection.
- id
id of the document underyling the datastructure
- options
options for controlling the behaviour of the datastructure
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def touch(id: String, expiry: Duration, options: TouchOptions): Try[MutationResult]
Updates the expiry of the document with the given id.
Updates the expiry of the document with the given id.
- id
the unique identifier of the document
- options
configure options that affect this operation
- returns
on success, a
Success(MutationResult)
, else aFailure(CouchbaseException)
. This could becom.couchbase.client.core.error.DocumentDoesNotExistException
, indicating the document could not be found. anyscala.util.control.NonFatal
error returned will derive ultimately fromcom.couchbase.client.core.error.CouchbaseException
. See the error handling docs for more detail.
- def touch(id: String, expiry: Duration, timeout: Duration = kvReadTimeout): Try[MutationResult]
Updates the expiry of the document with the given id.
Updates the expiry of the document with the given id.
This overload provides only the most commonly used options. If you need to configure something more esoteric, use the overload that takes an com.couchbase.client.scala.kv.TouchOptions instead, which supports all available options.
- id
the unique identifier of the document
- timeout
when the operation will timeout. This will default to
timeoutConfig().kvTimeout()
in the provided com.couchbase.client.scala.env.ClusterEnvironment.- returns
on success, a
Success(MutationResult)
, else aFailure(CouchbaseException)
. This could becom.couchbase.client.core.error.DocumentDoesNotExistException
, indicating the document could not be found. anyscala.util.control.NonFatal
error returned will derive ultimately fromcom.couchbase.client.core.error.CouchbaseException
. See the error handling docs for more detail.
- def unlock(id: String, cas: Long, options: UnlockOptions): Try[Unit]
Unlock a locked document.
Unlock a locked document.
- id
the unique identifier of the document
- cas
must match the CAS value return from a previous
.getAndLock()
to successfully unlock the document- options
configure options that affect this operation
- returns
on success, a
Success(Unit)
, else aFailure(CouchbaseException)
. This could becom .couchbase.client.core.error.DocumentDoesNotExistException
, indicating the document could not be found. anyscala.util.control.NonFatal
error returned will derive ultimately fromcom.couchbase.client.core.error.CouchbaseException
. See the error handling docs for more detail.
- def unlock(id: String, cas: Long, timeout: Duration = kvReadTimeout): Try[Unit]
Unlock a locked document.
Unlock a locked document.
This overload provides only the most commonly used options. If you need to configure something more esoteric, use the overload that takes an com.couchbase.client.scala.kv.UnlockOptions instead, which supports all available options.
- id
the unique identifier of the document
- cas
must match the CAS value return from a previous
.getAndLock()
to successfully unlock the document- timeout
when the operation will timeout. This will default to
timeoutConfig().kvTimeout()
in the provided com.couchbase.client.scala.env.ClusterEnvironment.- returns
on success, a
Success(Unit)
, else aFailure(CouchbaseException)
. This could becom .couchbase.client.core.error.DocumentDoesNotExistException
, indicating the document could not be found. anyscala.util.control.NonFatal
error returned will derive ultimately fromcom.couchbase.client.core.error.CouchbaseException
. See the error handling docs for more detail.
- def upsert[T](id: String, content: T, options: UpsertOptions)(implicit serializer: JsonSerializer[T]): Try[MutationResult]
Upserts the contents of a full document in this collection.
Upserts the contents of a full document in this collection.
Upsert here means to insert the document if it does not exist, or replace the content if it does.
- id
the unique identifier of the document
- content
this can be of any type for which an implicit
com.couchbase.client.scala.codec.Conversions.JsonSerializer
can be found: a list of types that are supported 'out of the box' is available at these JSON docs- options
configure options that affect this operation
- returns
on success, a
Success(MutationResult)
, else aFailure(CouchbaseException)
. anyscala.util.control.NonFatal
error returned will derive ultimately fromcom.couchbase.client.core.error.CouchbaseException
. See the error handling docs for more detail.
- def upsert[T](id: String, content: T, durability: Durability = Disabled, timeout: Duration = Duration.MinusInf)(implicit serializer: JsonSerializer[T]): Try[MutationResult]
Upserts the contents of a full document in this collection.
Upserts the contents of a full document in this collection.
Upsert here means to insert the document if it does not exist, or replace the content if it does.
This overloads provides only the most commonly used options. If you need to configure something more esoteric, use the overload that takes an com.couchbase.client.scala.kv.UpsertOptions instead, which supports all available options.
- id
the unique identifier of the document
- content
this can be of any type for which an implicit
com.couchbase.client.scala.codec.Conversions.JsonSerializer
can be found: a list of types that are supported 'out of the box' is available at these JSON docs- durability
writes in Couchbase are written to a single node, and from there the Couchbase Server will take care of sending that mutation to any configured replicas. This parameter provides some control over ensuring the success of the mutation's replication. See com.couchbase.client.scala.durability.Durability for a detailed discussion.
- timeout
when the operation will timeout. This will default to
timeoutConfig().kvTimeout()
in the provided com.couchbase.client.scala.env.ClusterEnvironment.- returns
on success, a
Success(MutationResult)
, else aFailure(CouchbaseException)
. anyscala.util.control.NonFatal
error returned will derive ultimately fromcom.couchbase.client.core.error.CouchbaseException
. See the error handling docs for more detail.
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated @Deprecated
- Deprecated