{
"_type": "Account",
...
}
References include the type of the document to permit the decoder to early-bind the reference-type to the correct object type.
{
"_type": "DOCUMENT_TYPE",
"$ref": "DOCUMENT_KEY"
}
{
"_type":"Date",
"v": "2007-03-01T13:00:00Z"
}
"2007-03-01T13:00:00Z"
{
"_type": "Map",
...
}
[...]
"..."
...
Basic Example:
ottoman.model({
name: "string"
})
Grouping Properties:
ottoman.model({
user: {
name: "string"
},
company: "string"
})
- .id
- .forceTyping
- .name
- .type
- .default
- .validator
- .readonly
- .auto
- Schema's must be defined before being embedded.
- Referenced Schema's can be used before being declared.
- id's cannot reference into a referenced Schema.
- Embedded properties can be nulled.
- Anonymous embedded schemas cannot be nulled (since you could never create them again).
- Schema's cannot cross context boundaries.
- Schema types are compared by-name and by-context.
- Model's are the [Function] constructors. Scheme's are the data layout.
- Validations are defined with the type (not separate).
- Pre/Post Events for Serialize/Deserialize/Validate,Save
- How do we deal with referenced objects that want to be loaded.
- .parent ModelData
- .$ ModelData
- .forceTyping bool (default: false)
- .ref(id) ModelInstance
- .findById(id) ModelInstance
- .$ ModelInstanceData
- .id() string
- .loaded() bool
- .load(callback) -
- .save(callback) -
- *special
- .inspect() string
- .toJSON() Object