21#include <bsoncxx/stdx/string_view.hpp>
23#include <bsoncxx/config/prelude.hpp>
26BSONCXX_INLINE_NAMESPACE_BEGIN
38class BSONCXX_API
oid {
75 explicit oid(
const char* bytes, std::size_t len);
86 explicit oid(
const bsoncxx::stdx::string_view& str);
120 BSONCXX_DEPRECATED
explicit operator bool()
const;
137 friend BSONCXX_PRIVATE
int oid_compare(
const oid& lhs,
const oid& rhs);
139 std::array<char, 12> _bytes;
142BSONCXX_INLINE_NAMESPACE_END
145#include <bsoncxx/config/postlude.hpp>
Represents a MongoDB ObjectId.
Definition oid.hpp:38
friend bool operator==(const oid &lhs, const oid &rhs)
Relational operators for OIDs.
friend bool operator!=(const oid &lhs, const oid &rhs)
Relational operators for OIDs.
oid(init_tag_t tag)
Constructs an oid and initializes it to a newly generated ObjectId.
oid(const bsoncxx::stdx::string_view &str)
Constructs an oid and initializes it from the provided hex string.
friend bool operator<(const oid &lhs, const oid &rhs)
Relational operators for OIDs.
friend bool operator>(const oid &lhs, const oid &rhs)
Relational operators for OIDs.
std::string to_string() const
Converts this oid to a hexadecimal string.
oid()
Constructs an oid and initializes it to a newly generated ObjectId.
friend bool operator>=(const oid &lhs, const oid &rhs)
Relational operators for OIDs.
friend bool operator<=(const oid &lhs, const oid &rhs)
Relational operators for OIDs.
std::time_t get_time_t() const
Extracts the timestamp portion of the underlying ObjectId.
const char * bytes() const
An accessor for the internal data buffer in the oid.
oid(const char *bytes, std::size_t len)
Constructs an oid initializes it to the contents of the provided buffer.
Top level namespace for MongoDB C++ BSON functionality.
Definition element.hpp:24