Issue with arrays?
animedbz16 opened this issue · 0 comments
animedbz16 commented
It seems that there is a problem with storing arrays with the memory adapter as testing this with the mongoDB adapter works fine.
module.exports = {
adapter: "memory",
attributes: {
string: {
type: 'string',
required: true,
notNull: true,
notEmpty: true,
},
array: {
type: 'array',
required: true,
notNull: true,
notEmpty: true,
}
},
beforeCreate: function(obj, next){
sails.log.info("beforeCreate", obj);
next();
},
afterCreate: function(obj, next){
sails.log.info("beforeCreate", obj);
next();
}
};
Logging output:
2014-05-23T18:25:10.736Z - info: beforeCreate { name: 'String', array: [ 'Element 1', 'Element 2', 'Element 3' ] }
TypeError: Cannot call method 'push' of undefined
at Object.module.exports.adapter.create (/home/user/sails-project/node_modules/sails-memory/index.js:276:25)
at module.exports.create (/home/user/sails-project/node_modules/sails/node_modules/waterline/lib/waterline/adapter/dql.js:12:18)
at /home/user/sails-project/node_modules/sails/node_modules/waterline/lib/waterline/query/dql.js:104:21
at /home/user/sails-project/node_modules/sails/node_modules/async/lib/async.js:229:13
at /home/user/sails-project/node_modules/sails/node_modules/async/lib/async.js:139:25
at /home/user/sails-project/node_modules/sails/node_modules/async/lib/async.js:226:17
at /home/user/sails-project/node_modules/sails/node_modules/async/lib/async.js:553:34
at /home/user/sails-project/node_modules/sails/node_modules/waterline/lib/waterline/query/dql.js:86:11
at /home/user/sails-project/node_modules/sails/node_modules/async/lib/async.js:139:25
at /home/user/sails-project/node_modules/sails/node_modules/waterline/lib/waterline/query/dql.js:80:13