diff --git a/lib/abstract-class.js b/lib/abstract-class.js index 491b5793..02add975 100644 --- a/lib/abstract-class.js +++ b/lib/abstract-class.js @@ -356,6 +356,8 @@ AbstractClass.all = function all(params, cb) { } cb(err, collection); } + else + cb(err, []); }); }; diff --git a/lib/adapters/neo4j.js b/lib/adapters/neo4j.js index 02cd858f..cf5c3f99 100644 --- a/lib/adapters/neo4j.js +++ b/lib/adapters/neo4j.js @@ -200,13 +200,18 @@ Neo4j.prototype.updateIndexes = function updateIndexes(model, node, cb) { Neo4j.prototype.save = function save(model, data, callback) { var self = this; + this.node(data.id, function (err, node) { + //delete id property since that's redundant and we use the node.id + delete data.id; if (err) return callback(err); node.data = cleanup(data); node.save(function (err) { if (err) return callback(err); self.updateIndexes(model, node, function (err) { if (err) return console.log(err); + //map node id to the id property being sent back + node.data.id = node.id; callback(null, node.data); }); }); @@ -342,6 +347,7 @@ Neo4j.prototype.updateAttributes = function updateAttributes(model, id, data, cb function cleanup(data) { if (!data) return null; + var res = {}; Object.keys(data).forEach(function (key) { var v = data[key];