mongo

Undocumented in source.

Members

Enums

MongoDocCreated
enum MongoDocCreated
Undocumented in source.
MongoDocUpdated
enum MongoDocUpdated
Undocumented in source.
MongoKeep
enum MongoKeep
Undocumented in source.

Functions

as
auto as(bson_value_t* val)

Converts a bson_value_t to another type. If BSON is used as a type, it assumes it's a document. Make sure to unlock() that BSON.

checkIfDefault
bool checkIfDefault(Type instance, BSON toAppendTo, bool ignoreDefaults)

Checks whether the instance of 'Type' has the default value on 'field' if it does and isn't marked with the MongoKeep UDA does nothing, else appends that field to the BSON. In case the field is a struct or array, it checks recursively.

empty
auto empty()
Undocumented in source. Be warned that the author may not have intended to support it.
fillBSON
bool fillBSON(Type instance, BSON toFill, bool ignoreDefaults)

Fills a BSON with the members from a struct. if ignoreDefaults is true, then values with the default value aren't added. this behavior is useful to toggle it on insertions but off for option or query parameters.

findID
bson_oid_t findID(bson_t* val)

Returns the _id field of a bson_t, it must have it and be of type OID.

fromId
string fromId(bson_oid_t id)
Undocumented in source. Be warned that the author may not have intended to support it.
fromJSON
BSON fromJSON(string json)

Creates a BSON from a JSON string. The BSON needs to be destroyed manually with unlock()

hasID
bool hasID(bson_t* val)
Undocumented in source. Be warned that the author may not have intended to support it.
strUDA
string strUDA()
Undocumented in source. Be warned that the author may not have intended to support it.
toBSON
auto ref toBSON(BSON ob, bool ignoreDefaults)

ignoreDefaults does nothing, is just for compatibility with the other toBSON.

toBSON
auto toBSON(Type instance, bool ignoreDefaults)

Converts a POD struct to a BSON object.

toId
bson_oid_t toId(string representation)

Converts a string to an object id.

Structs

BSON
struct BSON
Undocumented in source.
BSONIter
struct BSONIter

Empty if constructed with null.

Client
struct Client
Undocumented in source.
Collection
struct Collection
Undocumented in source.
Cursor
struct Cursor(ElementType = BSON)

Used for iterating mongoc_cursor_ts as input ranges.

Database
struct Database
Undocumented in source.
DateTime
struct DateTime

Used just for 'as' function.

MongoPool
struct MongoPool

Wrapper over mongoc_client_pool_t that allows getting a client with lock(). After usage this should be freed with unlock(). Note that this.unlock isn't the reverse operation of this.lock. Clients should use their unlock().

ScopedBSON
struct ScopedBSON

A BSON that is destroyed if created from a struct on its destructor and just a wrapper over an existing BSON otherwise.

Meta