55#ifndef COUCHBASE_CXX_CLIENT_DOXYGEN
114 [[nodiscard]] auto
name() const -> const std::
string&;
158 [[nodiscard]] auto
get(std::
string document_id, const
get_options& options = {})
const
159 -> std::future<std::pair<error, get_result>>;
178 std::chrono::seconds duration,
199 std::chrono::seconds duration,
201 -> std::future<std::pair<error, get_result>>;
220 std::chrono::system_clock::time_point time_point,
241 std::chrono::system_clock::time_point time_point,
243 -> std::future<std::pair<error, get_result>>;
262 std::chrono::seconds duration,
282 [[nodiscard]]
auto touch(std::string document_id,
283 std::chrono::seconds duration,
285 -> std::future<std::pair<error, result>>;
304 std::chrono::system_clock::time_point time_point,
324 [[nodiscard]]
auto touch(std::string document_id,
325 std::chrono::system_clock::time_point time_point,
327 -> std::future<std::pair<error, result>>;
376 -> std::future<std::pair<error, get_replica_result>>;
423 -> std::future<std::pair<error, get_all_replicas_result>>;
462 template<
typename Transcoder = codec::default_json_transcoder,
typename Document>
468 return upsert(std::move(document_id),
469 create_encode_fn<Transcoder, Document>(std::move(document)),
489 [[nodiscard]]
auto upsert(std::string document_id,
492 -> std::future<std::pair<error, mutation_result>>;
511 template<
typename Transcoder = codec::default_json_transcoder,
typename Document>
512 [[nodiscard]]
auto upsert(std::string document_id,
515 -> std::future<std::pair<error, mutation_result>>
518 std::move(document_id), create_encode_fn<Transcoder, Document>(std::move(document)), options);
561 std::enable_if_t<!std::is_same_v<codec::encoded_value, Document>,
bool> =
true>
567 return insert(std::move(document_id),
568 create_encode_fn<Transcoder, Document>(std::move(document)),
587 [[nodiscard]]
auto insert(std::string document_id,
590 -> std::future<std::pair<error, mutation_result>>;
613 std::enable_if_t<!std::is_same_v<codec::encoded_value, Document>,
bool> =
true>
614 [[nodiscard]]
auto insert(std::string document_id,
617 -> std::future<std::pair<error, mutation_result>>
620 std::move(document_id), create_encode_fn<Transcoder, Document>(std::move(document)), options);
665 std::enable_if_t<!std::is_same_v<codec::encoded_value, Document>,
bool> =
true>
671 return replace(std::move(document_id),
672 create_encode_fn<Transcoder, Document>(std::move(document)),
691 [[nodiscard]]
auto replace(std::string document_id,
694 -> std::future<std::pair<error, mutation_result>>;
719 std::enable_if_t<!std::is_same_v<codec::encoded_value, Document>,
bool> =
true>
720 [[nodiscard]]
auto replace(std::string document_id,
723 -> std::future<std::pair<error, mutation_result>>
726 std::move(document_id), create_encode_fn<Transcoder, Document>(std::move(document)), options);
768 -> std::future<std::pair<error, mutation_result>>;
818 -> std::future<std::pair<error, mutate_in_result>>;
860 -> std::future<std::pair<error, lookup_in_result>>;
904 const -> std::future<std::pair<error, lookup_in_all_replicas_result>>;
948 -> std::future<std::pair<error, lookup_in_replica_result>>;
962 std::chrono::seconds lock_duration,
978 std::chrono::seconds lock_duration,
980 -> std::future<std::pair<error, get_result>>;
1023 [[nodiscard]]
auto unlock(std::string document_id,
1058 -> std::future<std::pair<error, exists_result>>;
1093 -> std::future<std::pair<error, scan_result>>;
1123 -> std::future<std::pair<error, node_id>>;
1164 -> std::future<std::pair<
error, std::vector<node_id>>>;
1172 [[nodiscard]] auto crypto_manager() const -> const std::shared_ptr<
crypto::manager>&;
1174 template<typename Transcoder, typename Document>
1175 [[nodiscard]] auto create_encode_fn(Document document) const
1176 -> std::function<
codec::encoded_value()>
1179 return [crypto_manager = crypto_manager(),
1181 return Transcoder::encode(document, crypto_manager);
1185 return Transcoder::encode(document);
1190 void replace(std::string document_id,
1195 auto replace(std::string document_id,
1198 -> std::future<std::pair<error, mutation_result>>;
1200 void upsert(std::string document_id,
1205 auto upsert(std::string document_id,
1208 -> std::future<std::pair<error, mutation_result>>;
1210 void insert(std::string document_id,
1215 auto insert(std::string document_id,
1218 -> std::future<std::pair<error, mutation_result>>;
1223 std::string_view
name,
1224 std::shared_ptr<crypto::manager> crypto_manager);
1226 std::shared_ptr<collection_impl> impl_;
Allows to perform certain operations on non-JSON documents.
Definition binary_collection.hxx:47
Provides access to Couchbase bucket.
Definition bucket.hxx:49
CAS is a special type that represented in protocol using unsigned 64-bit integer, but only equality c...
Definition cas.hxx:34
The Query Index Manager interface contains the means for managing indexes used for queries.
Definition collection_query_index_manager.hxx:53
The collection provides access to all collection APIs.
Definition collection.hxx:76
auto touch(std::string document_id, std::chrono::system_clock::time_point time_point, const touch_options &options={}) const -> std::future< std::pair< error, result > >
Updates the expiration a document given an id, without modifying or returning its value.
auto replace(std::string document_id, codec::encoded_value document, const replace_options &options) const -> std::future< std::pair< error, mutation_result > >
Replaces a body of the document which already exists with specified encoded body.
friend class scope
Definition collection.hxx:1170
void replace(std::string document_id, Document document, const replace_options &options, replace_handler &&handler) const
Replaces a full document which already exists.
Definition collection.hxx:666
friend class bucket
Definition collection.hxx:1169
auto scan(const scan_type &scan_type, const scan_options &options={}) const -> std::future< std::pair< error, scan_result > >
Performs a key-value scan operation on the collection.
auto mutate_in(std::string document_id, const mutate_in_specs &specs, const mutate_in_options &options={}) const -> std::future< std::pair< error, mutate_in_result > >
Performs mutations to document fragments.
void remove(std::string document_id, const remove_options &options, remove_handler &&handler) const
Removes a Document from a collection.
auto bucket_name() const -> const std::string &
Returns name of the bucket where the collection is defined.
auto unlock(std::string document_id, couchbase::cas cas, const unlock_options &options={}) const -> std::future< error >
Unlocks a document if it has been locked previously, with default options.
void lookup_in_all_replicas(std::string document_id, const lookup_in_specs &specs, const lookup_in_all_replicas_options &options, lookup_in_all_replicas_handler &&handler) const
Performs lookups to document fragments with default options from all replicas and the active node and...
void get_and_lock(std::string document_id, std::chrono::seconds lock_duration, const get_and_lock_options &options, get_and_lock_handler &&handler) const
Gets a document for a given id and places a pessimistic lock on it for mutations.
static constexpr auto default_name
Constant for the name of the default collection in the bucket.
Definition collection.hxx:84
auto binary() const -> binary_collection
Provides access to the binary APIs, not used for JSON documents.
void scan(const scan_type &scan_type, const scan_options &options, scan_handler &&handler) const
Performs a key-value scan operation on the collection.
void lookup_in_any_replica(std::string document_id, const lookup_in_specs &specs, const lookup_in_any_replica_options &options, lookup_in_any_replica_handler &&handler) const
Performs lookups to document fragments with default options from all replicas and returns the first f...
void touch(std::string document_id, std::chrono::system_clock::time_point time_point, const touch_options &options, touch_handler &&handler) const
Updates the expiration a document given an id, without modifying or returning its value.
void exists(std::string document_id, const exists_options &options, exists_handler &&handler) const
Checks if the document exists on the server.
void get_and_touch(std::string document_id, std::chrono::seconds duration, const get_and_touch_options &options, get_and_touch_handler &&handler) const
Fetches a full document and resets its expiration time to the value provided.
auto lookup_in_all_replicas(std::string document_id, const lookup_in_specs &specs, const lookup_in_all_replicas_options &options={}) const -> std::future< std::pair< error, lookup_in_all_replicas_result > >
Performs lookups to document fragments with default options from all replicas and the active node and...
void get_any_replica(std::string document_id, const get_any_replica_options &options, get_any_replica_handler &&handler) const
Reads all available replicas, and returns the first found.
auto insert(std::string document_id, Document document, const insert_options &options={}) const -> std::future< std::pair< error, mutation_result > >
Inserts a full document which does not exist yet with custom options.
Definition collection.hxx:614
auto get_and_touch(std::string document_id, std::chrono::seconds duration, const get_and_touch_options &options={}) const -> std::future< std::pair< error, get_result > >
Fetches a full document and resets its expiration time to the value provided.
void lookup_in(std::string document_id, const lookup_in_specs &specs, const lookup_in_options &options, lookup_in_handler &&handler) const
Performs lookups to document fragments with default options.
void replace(std::string document_id, codec::encoded_value document, const replace_options &options, replace_handler &&handler) const
Replaces a body of the document which already exists with specified encoded body.
auto get_and_touch(std::string document_id, std::chrono::system_clock::time_point time_point, const get_and_touch_options &options={}) const -> std::future< std::pair< error, get_result > >
Fetches a full document and resets its expiration time to the absolute value provided.
auto replace(std::string document_id, Document document, const replace_options &options={}) const -> std::future< std::pair< error, mutation_result > >
Replaces a full document which already exists.
Definition collection.hxx:720
auto touch(std::string document_id, std::chrono::seconds duration, const touch_options &options={}) const -> std::future< std::pair< error, result > >
Updates the expiration a document given an id, without modifying or returning its value.
void upsert(std::string document_id, codec::encoded_value document, const upsert_options &options, upsert_handler &&handler) const
Upserts an encoded body of the document which might or might not exist yet, with custom options.
void upsert(std::string document_id, Document document, const upsert_options &options, upsert_handler &&handler) const
Upserts a full document which might or might not exist yet with custom options.
Definition collection.hxx:463
auto remove(std::string document_id, const remove_options &options={}) const -> std::future< std::pair< error, mutation_result > >
Removes a Document from a collection.
auto name() const -> const std::string &
Returns name of the collection.
auto upsert(std::string document_id, codec::encoded_value document, const upsert_options &options) const -> std::future< std::pair< error, mutation_result > >
Upserts an encoded body of the document which might or might not exist yet, with custom options.
auto lookup_in(std::string document_id, const lookup_in_specs &specs, const lookup_in_options &options={}) const -> std::future< std::pair< error, lookup_in_result > >
Performs lookups to document fragments with default options.
auto exists(std::string document_id, const exists_options &options={}) const -> std::future< std::pair< error, exists_result > >
Checks if the document exists on the server.
void insert(std::string document_id, codec::encoded_value document, const insert_options &options, insert_handler &&handler) const
Inserts an encoded body of the document which does not exist yet with custom options.
void node_ids(const node_ids_options &options, node_ids_handler &&handler) const
Returns the set of cluster nodes that currently serve key-value traffic for this collection's bucket,...
auto node_ids(const node_ids_options &options={}) const -> std::future< std::pair< error, std::vector< node_id > > >
Returns the set of cluster nodes that currently serve key-value traffic for this collection's bucket,...
void get(std::string document_id, const get_options &options, get_handler &&handler) const
Fetches the full document from this collection.
auto get_all_replicas(std::string document_id, const get_all_replicas_options &options={}) const -> std::future< std::pair< error, get_all_replicas_result > >
Reads from all available replicas and the active node and returns the results as a vector.
auto get_and_lock(std::string document_id, std::chrono::seconds lock_duration, const get_and_lock_options &options={}) const -> std::future< std::pair< error, get_result > >
Gets a document for a given id and places a pessimistic lock on it for mutations.
auto node_id_for(std::string document_id, const node_id_for_options &options={}) const -> std::future< std::pair< error, node_id > >
Resolves a document key to the identity of the cluster node that currently owns it,...
void node_id_for(std::string document_id, const node_id_for_options &options, node_id_for_handler &&handler) const
Resolves a document key to the identity of the cluster node that currently owns it,...
auto get_any_replica(std::string document_id, const get_any_replica_options &options={}) const -> std::future< std::pair< error, get_replica_result > >
Reads all available replicas, and returns the first found.
auto lookup_in_any_replica(std::string document_id, const lookup_in_specs &specs, const lookup_in_any_replica_options &options={}) const -> std::future< std::pair< error, lookup_in_replica_result > >
Performs lookups to document fragments with default options from all replicas and returns the first f...
void get_all_replicas(std::string document_id, const get_all_replicas_options &options, get_all_replicas_handler &&handler) const
Reads from all available replicas and the active node and returns the results as a vector.
auto upsert(std::string document_id, Document document, const upsert_options &options={}) const -> std::future< std::pair< error, mutation_result > >
Upserts a full document which might or might not exist yet with custom options.
Definition collection.hxx:512
auto query_indexes() const -> collection_query_index_manager
void mutate_in(std::string document_id, const mutate_in_specs &specs, const mutate_in_options &options, mutate_in_handler &&handler) const
Performs mutations to document fragments.
void unlock(std::string document_id, couchbase::cas cas, const unlock_options &options, unlock_handler &&handler) const
Unlocks a document if it has been locked previously, with default options.
auto insert(std::string document_id, codec::encoded_value document, const insert_options &options) const -> std::future< std::pair< error, mutation_result > >
Inserts an encoded body of the document which does not exist yet with custom options.
auto scope_name() const -> const std::string &
Returns name of the scope where the collection is defined.
void touch(std::string document_id, std::chrono::seconds duration, const touch_options &options, touch_handler &&handler) const
Updates the expiration a document given an id, without modifying or returning its value.
void get_and_touch(std::string document_id, std::chrono::system_clock::time_point time_point, const get_and_touch_options &options, get_and_touch_handler &&handler) const
Fetches a full document and resets its expiration time to the absolute value provided.
void insert(std::string document_id, Document document, const insert_options &options, insert_handler &&handler) const
Inserts a full document which does not exist yet with custom options.
Definition collection.hxx:562
Definition lookup_in_specs.hxx:34
Definition mutate_in_specs.hxx:80
The scope identifies a group of collections and allows high application density as a result.
Definition scope.hxx:47
Definition analytics_options.hxx:35
constexpr bool is_crypto_transcoder_v
Definition transcoder_traits.hxx:36
json_transcoder< tao_json_serializer > default_json_transcoder
Definition default_json_transcoder.hxx:28
Definition internal.hxx:27
Represents a single item from the result of scan().
Definition allow_querying_search_index_options.hxx:28
std::function< void(error, get_replica_result)> get_any_replica_handler
The signature for the handler of the get_any_replica() operation.
Definition get_any_replica_options.hxx:92
std::function< void(error, mutation_result)> insert_handler
The signature for the handler of the insert() operation.
Definition insert_options.hxx:114
std::function< void(error, lookup_in_result)> lookup_in_handler
The signature for the handler of the lookup_in() operation.
Definition lookup_in_options.hxx:94
std::function< void(error, get_result)> get_handler
The signature for the handler of the get() operation.
Definition get_options.hxx:111
std::function< void(error, get_all_replicas_result)> get_all_replicas_handler
The signature for the handler of the get_all_replicas() operation.
Definition get_all_replicas_options.hxx:101
std::function< void(error, get_result)> get_and_lock_handler
The signature for the handler of the get_and_lock() operation.
Definition get_and_lock_options.hxx:70
std::function< void(error, mutation_result)> remove_handler
The signature for the handler of the remove() operation.
Definition remove_options.hxx:103
std::function< void(error, node_id)> node_id_for_handler
Definition node_id_for_options.hxx:59
std::function< void(error, mutation_result)> upsert_handler
The signature for the handler of the upsert() operation.
Definition upsert_options.hxx:138
std::function< void(error, mutate_in_result)> mutate_in_handler
The signature for the handler of the mutate_in() operation.
Definition mutate_in_options.hxx:219
std::function< void(error, lookup_in_all_replicas_result)> lookup_in_all_replicas_handler
The signature for the handler of the lookup_in_all_replicas() operation.
Definition lookup_in_all_replicas_options.hxx:106
std::function< void(error, scan_result)> scan_handler
The signature for the handler of the scan() operation.
Definition scan_options.hxx:168
std::function< void(error, result)> touch_handler
The signature for the handler of the touch() operation.
Definition touch_options.hxx:70
std::function< void(error, mutation_result)> replace_handler
The signature for the handler of the replace() operation.
Definition replace_options.hxx:167
std::function< void(error, lookup_in_replica_result)> lookup_in_any_replica_handler
The signature for the handler of the lookup_in_any_replica() operation.
Definition lookup_in_any_replica_options.hxx:97
std::function< void(error)> unlock_handler
The signature for the handler of the unlock() operation.
Definition unlock_options.hxx:73
std::function< void(error, get_result)> get_and_touch_handler
The signature for the handler of the get_and_touch() operation.
Definition get_and_touch_options.hxx:70
std::function< void(error, std::vector< node_id >)> node_ids_handler
Definition node_ids_options.hxx:60
std::function< void(error, exists_result)> exists_handler
The signature for the handler of the exists() operation.
Definition exists_options.hxx:74
Definition encoded_value.hxx:27
Options for exists().
Definition exists_options.hxx:41
Options for get_all_replicas().
Definition get_all_replicas_options.hxx:36
Options for collection::get_and_lock().
Definition get_and_lock_options.hxx:37
Options for collection::get_and_touch().
Definition get_and_touch_options.hxx:37
Options for collection::get_any_replica().
Definition get_any_replica_options.hxx:35
Options for collection::get().
Definition get_options.hxx:37
Options for insert().
Definition insert_options.hxx:41
Options for lookup_in_all_replicas().
Definition lookup_in_all_replicas_options.hxx:41
Options for lookup_in_any_replica().
Definition lookup_in_any_replica_options.hxx:40
Options for lookup_in().
Definition lookup_in_options.hxx:44
Options for mutate_in().
Definition mutate_in_options.hxx:44
Options for node_id_for().
Definition node_id_for_options.hxx:35
Options for node_ids().
Definition node_ids_options.hxx:36
Options for remove().
Definition remove_options.hxx:41
Options for replace().
Definition replace_options.hxx:41
Options for scan().
Definition scan_options.hxx:40
The base class for the different scan types.
Definition scan_type.hxx:96
Options for collection::touch().
Definition touch_options.hxx:37
Options for unlock().
Definition unlock_options.hxx:40
Options for upsert().
Definition upsert_options.hxx:41