These are chat archives for Automattic/mongoose

Apr 2015
Roland N Sharp
Apr 29 2015 05:01
Since upgrading to 4.0.2, I'm having issue with my pre and postSave middleware. preSave I set this.wasNew = this.isNew; but since upgrading, I can't pick up this.wasNew in the postSave middleware. Although, I can still pick up the isNew object.
Joseph Thibeault
Apr 29 2015 14:35
how would you guys conditionally require a field
i guess that’s maybe just a custom validator
Valeri Karpov
Apr 29 2015 20:34
@derickbailey re: 4.0.2 bson require() error, see Automattic/mongoose#2908 . Was fixed. Don't know why it came up in 4.0.2 though as opposed to 4.0.1
@johnwp can you open up an issue with the code you're using to connect?
@rolandnsharp can you provide more info? In theory this should still work
@jrthib new mongoose.Schema({ name: { type: String, required: function() { /* logic here */ } }); should work
Jake Sellers
Apr 29 2015 21:04
project has been running on mongoose 3.8 for a while now and I was asked to see if an upgrade to 4.x would be feasible
upgrade to 4.x causes to break, callback is never called
is this a known issue?
Allen Lamphear
Apr 29 2015 21:47
Quick question since I am new to mongoose. I have a page that has players and I have a page that has a form for scores. I need to populate a select element with the players collection into the scores page. "How do I go about doing that?" I tried to reference players into scores model and I get an error with "Cannot overwrite 'players' model once compiled" .