node-orm2 icon indicating copy to clipboard operation
node-orm2 copied to clipboard

MongoDB support for additional properties

Open kolypto opened this issue 11 years ago • 1 comments

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.

kolypto avatar Nov 18 '13 22:11 kolypto

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.

rafaelkaufmann avatar Dec 05 '13 15:12 rafaelkaufmann