firebase:: firestore:: SetOptions
#include <set_options.h>
An options object that configures the behavior of Set() calls.
Summary
By providing theSetOptions objects returned byMerge(), the Set() methods inDocumentReference,WriteBatch andTransaction can be configured to perform granular merges instead of overwriting the target documents in their entirety.
Constructors and Destructors | |
|---|---|
SetOptions()CreatesSetOptions with overwrite semantics. | |
SetOptions(constSetOptions & other)Copy constructor. | |
SetOptions(SetOptions && other)Move constructor. | |
~SetOptions() |
Public types | |
|---|---|
Type{ | enum The enumeration of all types ofSetOptions. |
Public functions | |
|---|---|
operator=(constSetOptions & other)=default | Copy assignment operator. |
operator=(SetOptions && other)=default | Move assignment operator. |
Public static functions | |
|---|---|
Merge() | Returns an instance that can be used to change the behavior of Set() calls to only replace the values specified in its data argument. |
MergeFieldPaths(const std::vector<FieldPath > & fields) | Returns an instance that can be used to change the behavior of Set() calls to only replace the given fields. |
MergeFields(const std::vector< std::string > & fields) | Returns an instance that can be used to change the behavior of Set() calls to only replace the given fields. |
Public types
Type
TypeThe enumeration of all types ofSetOptions.
Public functions
SetOptions
SetOptions(constSetOptions&other)=default
Copy constructor.
This performs a deep copy, creating an independent instance.
| Details | |||
|---|---|---|---|
| Parameters |
|
SetOptions
SetOptions(SetOptions&&other)=default
Move constructor.
Moving is more efficient than copying forSetOptions. After being moved from,SetOptions is in a valid but unspecified state.
| Details | |||
|---|---|---|---|
| Parameters |
|
operator=
SetOptions&operator=(constSetOptions&other)=default
Copy assignment operator.
This performs a deep copy, creating an independent instance.
| Details | |||
|---|---|---|---|
| Parameters |
| ||
| Returns | Reference to the destination SetOptions. |
operator=
SetOptions&operator=(SetOptions&&other)=default
Move assignment operator.
Moving is more efficient than copying forSetOptions. After being moved from,SetOptions is in a valid but unspecified state.
| Details | |||
|---|---|---|---|
| Parameters |
| ||
| Returns | Reference to the destination SetOptions. |
~SetOptions
~SetOptions()
Public static functions
Merge
SetOptionsMerge()
Returns an instance that can be used to change the behavior of Set() calls to only replace the values specified in its data argument.
Fields omitted from the Set() call will remain untouched.
MergeFieldPaths
SetOptionsMergeFieldPaths(conststd::vector<FieldPath>&fields)
Returns an instance that can be used to change the behavior of Set() calls to only replace the given fields.
Any field that is not specified infields is ignored and remains untouched.
It is an error to pass aSetOptions object to a Set() call that is missing a value for any of the fields specified here in its to data argument.
| Details | |||
|---|---|---|---|
| Parameters |
|
MergeFields
SetOptionsMergeFields(conststd::vector<std::string>&fields)
Returns an instance that can be used to change the behavior of Set() calls to only replace the given fields.
Any field that is not specified infields is ignored and remains untouched.
It is an error to pass aSetOptions object to a Set() call that is missing a value for any of the fields specified here.
| Details | |||
|---|---|---|---|
| Parameters |
|
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-01-23 UTC.