Ditto 3.0.3-alpha2
|
An identifier for a Document
.
More...
#include <DocumentId.hpp>
Public Member Functions | |
DocumentId (nlohmann::json id_value) | |
Creates a new DocumentId . More... | |
bool | operator== (const DocumentId &rhs) const |
bool | operator!= (const DocumentId &rhs) const |
DocumentIdPath | operator[] (std::string key) const |
Used to specify a path to a key in the document ID that you can subscript further to access a nested key in the document ID. More... | |
DocumentIdPath | operator[] (std::size_t index) const |
Used to specify an index in the array at the preceding key-path specified through the subscripting defined previously. You can subscript the return value further to access a further nested key in the document ID. More... | |
bool | empty () const |
Returns whether or not the document ID is empty (and therefore invalid). More... | |
nlohmann::json | value () const |
Get the underlying value of the document identifier as a native type. More... | |
std::string | to_string () const |
Returns a stringified representation of a document identifier. More... | |
An identifier for a Document
.
Each DocumentId
represents a unique identifier for a document.
|
explicit |
Creates a new DocumentId
.
A document ID can be created from any of the following:
Note that you cannot use floats or other custom types to create a document ID.
Document IDs are also limited in size, based on their serialized representation, to 256 bytes. You will receive an error if you try to create a document ID that exceeds the size limit.
[in] | value | the value that represents the document identifier. |
DocumentId
that uniquely identifies a Document. bool ditto::DocumentId::empty | ( | ) | const |
Returns whether or not the document ID is empty (and therefore invalid).
bool
representing whether or not the document ID is empty (and therefore invalid). DocumentIdPath ditto::DocumentId::operator[] | ( | std::size_t | index | ) | const |
Used to specify an index in the array at the preceding key-path specified through the subscripting defined previously. You can subscript the return value further to access a further nested key in the document ID.
[in] | index | the index of the array that you wish to access in the key previously specified with the preceding subscripting. |
DocumentIdPath ditto::DocumentId::operator[] | ( | std::string | key | ) | const |
Used to specify a path to a key in the document ID that you can subscript further to access a nested key in the document ID.
[in] | key | the next part of the path needed to get to the key in the document ID you wish to get the value of. |
std::string ditto::DocumentId::to_string | ( | ) | const |
Returns a stringified representation of a document identifier.
The returned string can be used directly in queries that you use with other Ditto functions. For example you could create a query that was like this:
json ditto::DocumentId::value | ( | ) | const |
Get the underlying value of the document identifier as a native type.