MongoSchema

Mixin for functions for interacting with Mongo collections.

Members

Functions

remove
bool remove()

Removes this object from the collection. Returns false when _id of this is not set.

save
void save()

Inserts or updates an existing value.

Properties

bsonID
BsonObjectID bsonID [@property getter]

Static functions

find
typeof(this)[] find(T query, QueryFlags flags, int num_skip, int num_docs_per_chunk)

Finds one or more elements using a query.

find
deprecated typeof(this)[] find()

Queries all elements from the collection.

findAll
DocumentRange!(typeof(this)) findAll()

Queries all elements from the collection as range.

findById
typeof(this) findById(BsonObjectID id)

Finds one element with the object id id

findById
typeof(this) findById(string id)

Finds one element with the hex id id

findOne
typeof(this) findOne(T query)

Finds one element using a query.

findOneOrThrow
auto findOneOrThrow(T query)
Undocumented in source. Be warned that the author may not have intended to support it.
findRange
DocumentRange!(typeof(this)) findRange(T query, QueryFlags flags, int num_skip, int num_docs_per_chunk)

Finds one or more elements using a query as range.

tryFindById
Nullable!(typeof(this)) tryFindById(BsonObjectID id)
Undocumented in source. Be warned that the author may not have intended to support it.
tryFindById
Nullable!(typeof(this)) tryFindById(string id)
Undocumented in source. Be warned that the author may not have intended to support it.
tryFindOne
Nullable!(typeof(this)) tryFindOne(T query)
Undocumented in source. Be warned that the author may not have intended to support it.
update
void update(T query, U update, UpdateFlags options)

Updates a document.

upsert
void upsert(T query, U update, UpdateFlags options)

Updates a document or inserts it when not existent. Shorthand for update(..., UpdateFlags.upsert)

Static variables

_schema_collection_
MongoCollection _schema_collection_;
Undocumented in source.

Meta