Optional
choicesOptional
collectionUsed for properties that are references to other documents. The value of this should be the name of the collection that the referenced document lives in.
eg. collection: "Users",
would be useful for refering to documents that live in a "Users" collection of a database.
No, you cannot refer to collections that exist in separate database clients.
Optional
defaultThe default data of this property, to be used if no data is provided or if a soft-invalidation occurs.
Optional
invalidateDetermines whether not an invalid value for min, max, minLength, and maxLength properties will throw an error or just roll-over and allow the value to exist. Depending on the property, it may get replaced with a default or min or max value if this is set to false.
Optional
matchThe regex expression that will be run against this property's data value. If the regex doesn't match, validation fails.
Optional
maxThe highest value that this property can have for its data value. For properties that are numbers.
Optional
maxThe highest length that this property can have for its data value. For properties that are strings or arrays.
Optional
minThe lowest value that this property can have for its data value. For properties that are numbers.
Optional
minThe shortest length that this property can have for its data value. For properties that are strings or arrays.
Optional
padIf an array data value's length is too short, this is the value that will be used to pad the array until it meets the minLength
property.
Optional
padIf a string data value is too short, this is the value that will be used to pad the data until it meets the minLength
property.
Optional
requiredWhether or not a property defined in the document's rules
object must have a value in its data.
A JavaScript class or type. This should be on every document key rule object, it is required. Various other constraints depend on the type!
Optional
uniqueWhether or not the data value for this property should be unique within the database. This sets up a NeDB index, so it's not immediately checked at a SuperCamo level - but NeDB immediately enforces it.
Optional
validateA custom validate function that runs alongside any other constraints. The function must receive one parameter, which the document will pass in automatically - the parameter is the document's data for this property.
An array of data that should match the specified type, to restrict the possible values of this property.