Specifies that this property should be stored using the MongoDB binary type and represented as a Buffer.
This decorator applies a Buffer validator to the property, which ensures that values you send to the database are well formatted Buffer objects represented using the BSON Binary datatype. In addition to this, it will apply a transform which ensures you only work with Buffer objects and that data is always stored in Binary format.
Specifies the name of the collection to which this instance's documents should be sent.
The name of the MongoDB collection to store the documents in.
This decorator replaces the use of the static collection property on instance implementation classes. If your transpiler does not support decorators then you are free to make use of the property instead.
Returns a promise which will be resolved with undefined
after given ms
milliseconds.
The amount of time, in milliseconds, to wait before resolving
Returns a promise which will be resolved with value
after given ms
milliseconds. If value
is a promise, the delay will start counting down when it is
fulfilled with the fullfilment value of the value
promise. If value
is a rejected
promise, the resulting promise will be immediately rejected.
The amount of time, in milliseconds, to wait before resolving
A factory method which creates Express/Connect compatible middleware functions to inject a "db" field on your request objects as well as ensuring that the Iridium Core is connected to a MongoDB database before handling any requests.
A method which maps a promised list to another promised list using the provided mapping function.
The promise that provides the list
The method which is used to map an input entry to an output entry
Specifies that the instance is a result of a mapReduce operation and functions of that operation.
Type of the mapped keys
Type of the mapped values
Interface of the document on which the operation will run
A function which maps documents.
A function which reduces mapped pairs.
This decorator replaces the use of the static mapReduce property on instance implementation classes. If your transpiler does not support decorators then you are free to make use of the property instead.
Creates a new subclass of the given instanceType which correctly performs property transforms and associates the instance with the correct model when instantiated.
The interface representing the structure of the documents found in the database.
The interface or class representing the documents after they have been wrapped in an instance.
The model which instances should be associated with when the resulting constructor is used.
The constructor used to create new instances of type TInstance.
Adds support for using callbacks with methods which commonly return promises.
The promise that is usually returned by the method.
The callback provided in lieu of using a promise.
Specifies that this property should be treated as an ObjectID, with the requisite validator and transforms.
This decorator applies an ObjectID validator to the property, which ensures that values sent to the database are instances of the MongoDB ObjectID type, as well as applying a transform operation which converts ObjectIDs to strings for your application, and then converts strings back to ObjectIDs for the database.
Renames a code field to a new name when it is persisted in the database
the name of the field as it is stored in the DB
Specifies a custom transform to be applied to the property this decorator is applied to.
The function used to convert values from the database for the application.
The function used to convert values from the application to the form used in the database.
Property transforms are lazily evaluated when their fields are accessed for performance reasons. Modifying the values of an array or object will not trigger its transform function unless the document level property is re-assigned.
This decorator can either compliment or replace the static transforms property on your instance class, however only one transform can be applied to any property at a time. If your transpiler does not support decorators then you are free to make use of the property instead.
If this decorator is applied to the instance class itself, as opposed to a property, then it will be treated as a $document transformer - and will receive the full document as opposed to individual property values. Similarly, it is expected to return a full document when either fromDB or toDB is called.
Provides an easy to use decorator which allows you to use a compatible class as a transform type for this field.
A class whose constructor accepts the DB object and which implements a toDB() method to convert back to a DB object
Provides an easy to use decorator which allows you to use a compatible class as a transform type for this field.
A class whose constructor accepts the DB object and which implements a toDB() method to convert back to a DB object
Specifies a custom validator to be made available for this collection's schema. More than one instance of this decorator may be used if you wish to specify multiple validators.
The value in the schema which will be delegated to this function for validation.
A function which calls this.assert(condition) to determine whether a schema node is valid or not.
This decorator replaces the use of the static validators property on instance implementation classes. If your transpiler does not support decorators then you are free to make use of the property instead.
Type guard method which determines whether an object has an _id field present.
The object to test for a _id field.
Boolean indicating whether the object has an _id field present.
Type guard method which determines whether an object has an _id field present and populated.
The object to test for a _id field.
Boolean indicating whether the object has an _id field present.
Converts a Node.js Buffer into a MongoDB Binary object. This is a shortcut
for new require("mongodb").Binary(buffer)
.
The Buffer which you would like to convert into a Binary object
Converts a string into a Decimal128 instance - a shortcut for
require("mongodb").Decimal128.fromString(value)
.
The string representation of a decimal number
A MongoDB Decimal128 instance equivalent to the string you provided.
Converts a string into a Long instance - a shortcut for
require("mongodb").Long.fromString(value)
.
The string representation of a decimal number
A MongoDB Long instance equivalent to the string you provided.
Converts a string to an ObjectID instance - a shortcut for require("mongodb").ObjectID.createFromHexString
The string representation of the ObjectID you wish to create.
A MongoDB ObjectID instance equivalent to the string you provided.
You should be aware that this method performs no validation on the received string, MongoDB's ObjectID requires that it either be a 12 byte UTF8 string, or a 24 byte hexadecimal string in order to be converted correctly.
This method removes the need for your application to directly depend on MongoDB's Node.js client library, which helps clean up your code a bit and reduces the headache of maintaining two different versions of the library (since Iridium also has one).
Generated using TypeDoc
Objects which are to be inserted into the DB can either be in the TDocument format used by the DB already, or have a toDB() method which returns such a document for insertion.