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

custom type - 'prop' never set?

Open ShawnTalbert opened this issue 10 years ago • 0 comments

When defining a custom type, it appears the 'prop' argument for valueToProperty and propertyToValue is never provided or used. It is always undefined?

db.defineType('numberArray', {
                datastoreType: function(prop) {
                    return 'TEXT'
                },
                valueToProperty: function(value, prop) {
                    if (Array.isArray(value)) {
                        return value;
                    } else {
                        return value.split(',').map(function (v) {
                            return Number(v);
                        });
                    }
                },
                propertyToValue: function(value, prop) {
                    return value.join(',')
                }
            });

ShawnTalbert avatar Oct 18 '15 18:10 ShawnTalbert