53#ifndef COUCHBASE_CXX_CLIENT_DOXYGEN
98 [[nodiscard]] auto
scope_name() const -> const std::
string&;
108 [[nodiscard]] auto
name() const -> const std::
string&;
152 [[nodiscard]] auto
get(std::
string document_id, const
get_options& options = {})
const
153 -> std::future<std::pair<error, get_result>>;
172 std::chrono::seconds duration,
193 std::chrono::seconds duration,
195 -> std::future<std::pair<error, get_result>>;
214 std::chrono::system_clock::time_point time_point,
235 std::chrono::system_clock::time_point time_point,
237 -> std::future<std::pair<error, get_result>>;
256 std::chrono::seconds duration,
276 [[nodiscard]]
auto touch(std::string document_id,
277 std::chrono::seconds duration,
279 -> std::future<std::pair<error, result>>;
298 std::chrono::system_clock::time_point time_point,
318 [[nodiscard]]
auto touch(std::string document_id,
319 std::chrono::system_clock::time_point time_point,
321 -> std::future<std::pair<error, result>>;
370 -> std::future<std::pair<error, get_replica_result>>;
417 -> std::future<std::pair<error, get_all_replicas_result>>;
456 template<
typename Transcoder = codec::default_json_transcoder,
typename Document>
463 std::move(document_id), Transcoder::encode(document), options, std::move(handler));
481 [[nodiscard]]
auto upsert(std::string document_id,
484 -> std::future<std::pair<error, mutation_result>>;
503 template<
typename Transcoder = codec::default_json_transcoder,
typename Document>
504 [[nodiscard]]
auto upsert(std::string document_id,
505 const Document& document,
507 -> std::future<std::pair<error, mutation_result>>
509 return upsert(std::move(document_id), Transcoder::encode(document), options);
552 std::enable_if_t<!std::is_same_v<codec::encoded_value, Document>,
bool> =
true>
559 std::move(document_id), Transcoder::encode(document), options, std::move(handler));
576 [[nodiscard]]
auto insert(std::string document_id,
579 -> std::future<std::pair<error, mutation_result>>;
602 std::enable_if_t<!std::is_same_v<codec::encoded_value, Document>,
bool> =
true>
603 [[nodiscard]]
auto insert(std::string document_id,
604 const Document& document,
606 -> std::future<std::pair<error, mutation_result>>
608 return insert(std::move(document_id), Transcoder::encode(document), options);
653 std::enable_if_t<!std::is_same_v<codec::encoded_value, Document>,
bool> =
true>
660 std::move(document_id), Transcoder::encode(document), options, std::move(handler));
677 [[nodiscard]]
auto replace(std::string document_id,
680 -> std::future<std::pair<error, mutation_result>>;
705 std::enable_if_t<!std::is_same_v<codec::encoded_value, Document>,
bool> =
true>
706 [[nodiscard]]
auto replace(std::string document_id,
707 const Document& document,
709 -> std::future<std::pair<error, mutation_result>>
711 return replace(std::move(document_id), Transcoder::encode(document), options);
753 -> std::future<std::pair<error, mutation_result>>;
803 -> std::future<std::pair<error, mutate_in_result>>;
845 -> std::future<std::pair<error, lookup_in_result>>;
889 const -> std::future<std::pair<error, lookup_in_all_replicas_result>>;
933 -> std::future<std::pair<error, lookup_in_replica_result>>;
947 std::chrono::seconds lock_duration,
963 std::chrono::seconds lock_duration,
965 -> std::future<std::pair<error, get_result>>;
1008 [[nodiscard]]
auto unlock(std::string document_id,
1043 -> std::future<std::pair<error, exists_result>>;
1078 -> std::future<std::pair<error, scan_result>>;
1089 std::string_view
name);
1091 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:45
CAS is a special type that represented in protocol using unsigned 64-bit integer, but only equality c...
Definition cas.hxx:34
The cluster is the main entry point when connecting to a Couchbase cluster.
Definition cluster.hxx:60
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:70
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.
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:654
auto insert(std::string document_id, const 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:603
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:78
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 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 replace(std::string document_id, const Document &document, const replace_options &options={}) const -> std::future< std::pair< error, mutation_result > >
Replaces a full document which already exists.
Definition collection.hxx:706
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 upsert(std::string document_id, const 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:504
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:457
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 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 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 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:553
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
json_transcoder< tao_json_serializer > default_json_transcoder
Definition default_json_transcoder.hxx:28
Represents a single item from the result of collection::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 collection::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 collection::insert() operation.
Definition insert_options.hxx:114
@ replace
Replace the document, fail if it does not exist.
@ upsert
Replace the document or create it if it does not exist.
@ insert
Create the document, fail if it exists.
std::function< void(error, lookup_in_result)> lookup_in_handler
The signature for the handler of the collection::lookup_in() operation.
Definition lookup_in_options.hxx:94
std::function< void(error, get_result)> get_handler
The signature for the handler of the collection::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 collection::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 collection::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 collection::remove() operation.
Definition remove_options.hxx:103
std::function< void(error, mutation_result)> upsert_handler
The signature for the handler of the collection::upsert() operation.
Definition upsert_options.hxx:138
std::function< void(error, mutate_in_result)> mutate_in_handler
The signature for the handler of the collection::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 collection::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 collection::scan() operation.
Definition scan_options.hxx:168
std::function< void(error, result)> touch_handler
The signature for the handler of the collection::touch() operation.
Definition touch_options.hxx:70
std::function< void(error, mutation_result)> replace_handler
The signature for the handler of the collection::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 collection::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 collection::unlock() operation.
Definition unlock_options.hxx:73
std::function< void(error, get_result)> get_and_touch_handler
The signature for the handler of the collection::get_and_touch() operation.
Definition get_and_touch_options.hxx:70
std::function< void(error, exists_result)> exists_handler
The signature for the handler of the collection::exists() operation.
Definition exists_options.hxx:74
Definition encoded_value.hxx:27
Options for collection::exists().
Definition exists_options.hxx:41
Options for collection::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 collection::insert().
Definition insert_options.hxx:41
Options for collection::lookup_in_all_replicas().
Definition lookup_in_all_replicas_options.hxx:41
Options for collection::lookup_in_any_replica().
Definition lookup_in_any_replica_options.hxx:40
Options for collection::lookup_in().
Definition lookup_in_options.hxx:44
Options for collection::mutate_in().
Definition mutate_in_options.hxx:44
Options for collection::remove().
Definition remove_options.hxx:41
Options for collection::replace().
Definition replace_options.hxx:41
Options for collection::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 collection::unlock().
Definition unlock_options.hxx:40
Options for collection::upsert().
Definition upsert_options.hxx:41