Open varsis opened 10 years ago
Can you provide some sample code?
var Chat = db.define('chat', {
title: string,
date: Date
}
}, {
hooks: { afterSave: function(err){
// This gets printed twice
console.log('AfterSave Called');
}
});
var chat = new Chat.create({..data here..}, function(err,chat) {
// handle save here
});
The console log gets printed out twice.
I found the issue, however I don't know of any work around at the moment. What is happening is I have two models. One model contains the other and vice versa, however this is not done using the reverse that can be defined in a model (as it does not work with my setup)
I couldn't find anything on this but it looks like all of my hooks are being called twice, and this is causing issues for me, as I insert data after save. Any ideas as to why this be happening?