Skip to content

Instantly share code, notes, and snippets.

module.exports.models = {
updateOrCreate: function (criteria, values) {
var deferred = q.defer();
var self = this;
this.findOne(criteria)
.then(function (data) {
if (!data || data === null) {
self.create(values)
.then(function (data) {
console.log('created');