Specify specific elements in a document to mutate.
More...
#include <mutate_in_spec.hxx>
Specify specific elements in a document to mutate.
Used in collection::mutate_in, you can specify a specific path within a document to insert, remove, upsert. See collection::lookup_in.
You can pass in a primitive, like int, char*, etc..., std::string, a nlohmann::json object, or your own object which has to_json and from_json implemented. See https://github.com/nlohmann/json#basic-usage
◆ create_path()
Specify the mutation creates the entire path.
- Returns
- Reference to the spec, so you can chain the calls.
◆ expand_macro()
Specify the value in this mutation spec contains a mutate_in_macro.
- Returns
- Reference to the spec, so you can chain the calls.
◆ fulldoc_insert()
template<typename Content >
static mutate_in_spec couchbase::mutate_in_spec::fulldoc_insert |
( |
const Content & |
value | ) |
|
|
inlinestatic |
Inserts the content as the entire body of the document.
This is an insert - expecting there to be no document already there.
- Parameters
-
value | The content to place at that path. |
- Returns
- The newly created mutate_in_spec.
◆ fulldoc_upsert()
template<typename Content >
static mutate_in_spec couchbase::mutate_in_spec::fulldoc_upsert |
( |
const Content & |
value | ) |
|
|
inlinestatic |
Upsert the content as the entire body of the document.
Either replaces an existing document, or inserts a new one with the content provided.
- Parameters
-
value | The content to place at that path. |
- Returns
- The newly created mutate_in_spec.
◆ insert()
template<typename Content >
static mutate_in_spec couchbase::mutate_in_spec::insert |
( |
const std::string & |
path, |
|
|
const Content & |
value |
|
) |
| |
|
inlinestatic |
Insert content at a path within a document.
Expects there to be no content at this path.
- Parameters
-
path | A dot-separated string representing the path to mutate. |
value | The content to place at that path. |
- Returns
- The newly created mutate_in_spec.
◆ remove()
static mutate_in_spec couchbase::mutate_in_spec::remove |
( |
const std::string & |
path | ) |
|
|
inlinestatic |
Remove content at a path within a document.
- Parameters
-
path | A dot-separated string representing the path to remove. |
- Returns
- The newly created mutate_in_spec.
◆ upsert()
template<typename Content >
static mutate_in_spec couchbase::mutate_in_spec::upsert |
( |
const std::string & |
path, |
|
|
const Content & |
value |
|
) |
| |
|
inlinestatic |
Upsert content at a path within a document.
Either inserts the content, or replaces existing content at this path.
- Parameters
-
path | A dot-separated string representing the path to mutate. |
value | The content to place at that path. |
- Returns
- The newly created mutate_in_spec.
◆ xattr()
Specify the mutation is on xattrs, rather than the document body.
- Returns
- Reference to the spec, so you can chain the calls.
The documentation for this class was generated from the following file: