The Mongoose Schema for an
ExperimentSchema. This schema is used in
creating the Mongoose Model for an ExperimentSchema.
Methods
buildExperiment(callback)
This method draws one available ExperimentSchema document at random
from the database. This media array of this document is populated. For
any fixed media specified in the document, their details are found and
inserted directly into the final document. The callback will be called
upon completion and provided with the 'built' experiment.
Parameters:
| Name | Type | Description |
|---|---|---|
callback |
Node.module:ExperimentSchemaServerModel~buildExperimentCallback | Will be called upon completion |
(private, inner) requiredArrayValidator(value) → {Boolean}
A validator for Mongoose schemas that requires that its single argument
be an Array of length greater than 0.
Parameters:
| Name | Type | Description |
|---|---|---|
value |
* | The value to be validated |
Returns:
true if the validation is successful; false otherwise
- Type
- Boolean
(private, inner) updateSchemaForFixedMedia(schema, index, mediaId) → {bluebird.BluebirdPromise}
Given an ExperimentSchema, an index into that schema's media array, and
the ID of a Media document in the database, this function retrieves the
document associated with that ID from the database, and updates the media
array of the schema with information from this document. A promise is
returned that is resolved when the schema is updated.
Parameters:
| Name | Type | Description |
|---|---|---|
schema |
ExperimentSchema | |
index |
Number | The index into |
mediaId |
mongoose.ObjectId | The ID corresponding to the document that should be retrieved from the database |
Returns:
- Type
- bluebird.BluebirdPromise
Type Definitions
buildExperimentCallback(err, schema)
Parameters:
| Name | Type | Description |
|---|---|---|
err |
* | Any error that |
schema |
ExperimentSchema | The built |