Can I "reload" a model?

340 views
Skip to first unread message

Douglas Ferguson

unread,
Jan 18, 2015, 12:40:02 PM1/18/15
to mongoo...@googlegroups.com
This following blows up because the model is already "loaded"

var Movie = mongoose.model('Movie', movieSchema);
movieSchema.statics.findAllWithCreditCookies = function(callback) {
  return this.find({ hasCreditCookie: true }, callback);
};
db.model('Movie').findAllWithCreditCookies();

I found applyStatics in the Model class, but I'm not sure if it is a good practice to call this.

 
Reply all
Reply to author
Forward
0 new messages