Open ronald2wing opened 7 years ago
Chat.count({ id: chatId }, function(err, count) {
if (count === 0) {
Chat.create({ id: chatId }, (err) => {
console.log(err);
});
}
});
Right now I am combining count and create to create a similar method. Is there a better way to do this?
I find it difficult to implement this functionality. Has anyone done it before?