Skip to content

Commit

Permalink
Merge branch 'master' of github.com:1602/jugglingdb
Browse files Browse the repository at this point in the history
  • Loading branch information
1602 committed Aug 24, 2012
2 parents e46716f + 60fad51 commit a396348
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/abstract-class.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,8 @@ AbstractClass.all = function all(params, cb) {
}
cb(err, collection);
}
else
cb(err, []);
});
};

Expand Down
6 changes: 6 additions & 0 deletions lib/adapters/neo4j.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
Expand Down Expand Up @@ -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];
Expand Down

0 comments on commit a396348

Please sign in to comment.