Skip to content

Instantly share code, notes, and snippets.

var mongoose = require('mongoose');
var async = require('async');
// Mongoose 4.x+ doesn't actually call any Schema hooks added after
// a Model is created from that schema, so we do some patching to
// get that to occur. This is incredibly unfortunate.
// There is an assumption that the Model's schema will not be used
// to power any other models.
var events = ['save', 'remove'];