re-adding fix to not save id as a property on update
This commit is contained in:
parent
df798791fa
commit
3ca47526e5
|
@ -200,6 +200,8 @@ Neo4j.prototype.updateIndexes = function updateIndexes(model, node, cb) {
|
||||||
|
|
||||||
Neo4j.prototype.save = function save(model, data, callback) {
|
Neo4j.prototype.save = function save(model, data, callback) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
//delete id property since that's redundant and we use the node.id
|
||||||
|
delete data.id;
|
||||||
this.node(data.id, function (err, node) {
|
this.node(data.id, function (err, node) {
|
||||||
if (err) return callback(err);
|
if (err) return callback(err);
|
||||||
node.data = cleanup(data);
|
node.data = cleanup(data);
|
||||||
|
@ -207,6 +209,8 @@ Neo4j.prototype.save = function save(model, data, callback) {
|
||||||
if (err) return callback(err);
|
if (err) return callback(err);
|
||||||
self.updateIndexes(model, node, function (err) {
|
self.updateIndexes(model, node, function (err) {
|
||||||
if (err) return console.log(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);
|
callback(null, node.data);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue