node-orm2
node-orm2 copied to clipboard
MongoDB support for additional properties
MongoDB documents can accept any custom properties besides those defined in the model. Those should be retrieved and stored along with the defined properties: otherwise the use of NoSQL is completely useless.
Example: a collection to store arbitrary configuration objects by name, using the following model:
var Config = db.define('Config', {
_id: String
}, {
id: '_id',
table: 'config'
});
Currently, this only allows operations on the _id
field, ignoring all other document fields. Completely useless here.
This would involve holding, for each Instance, an internal array listing what properties to save and update. It's not clear to me that it's the best way to go, as opposed to, for instance, having "optional" fields in the schema definition.