Skip to content

Instantly share code, notes, and snippets.

@fnakstad
Last active December 19, 2015 23:18
Show Gist options
  • Select an option

  • Save fnakstad/6033333 to your computer and use it in GitHub Desktop.

Select an option

Save fnakstad/6033333 to your computer and use it in GitHub Desktop.
var mongoose = require('mongoose');
mongoose.Model.seed = function(entities) {
var promise = new mongoose.Promise;
this.create(entities, function(err) {
if(err) { promise.reject(err); }
else { promise.resolve(); }
});
return promise;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment