在这两种情况下,所有节点都有neoId === 999
schema.pre('save', function(next) {
var self = this;
this.neoId = 999;
// Save the topic
neo.query('MERGE (t:Topic { title: {title}, aliases: {aliases}, type: {type}, mongoId: {_id} }) RETURN id(t);', this, function(err, data) {
self.neoId = data;
console.log(self);
next(err); });
});
Aysnc:
schema.pre('save', true, function(next, done) {
var self = this;
this.neoId = 999;
// Save the topic
neo.query('MERGE (t:Topic { title: {title}, aliases: {aliases}, type: {type}, mongoId: {_id} }) RETURN id(t);', this, function(err, data) {
self.neoId = data;
console.log(self);
next(err);
done(err);
});
});
答案 0 :(得分:0)
我将self.neoId分配给一个数组。出于某种原因,它保留了999值而不是错误。无论如何,这有效:
setTexture