These are chat archives for Automattic/mongoose

30th
Jan 2018
Bruno Barros
@bybrunobarros
Jan 30 2018 09:55

Hey everyone! In this case

(provider.toObject()).notifications === Array(1)
provider.notifications === undefined

Aren't we supposed to get provider.notifications === Array(1)? I don't know why I'm sure I got this kind of result before, but I'm a bit lost now.

Kev
@lineus
Jan 30 2018 11:16
@bybrunobarros - I'm new to all of this, so unfortunately I can't help yet, but what is a provider in the context of mongoose?
Bruno Barros
@bybrunobarros
Jan 30 2018 11:22
@lineus oh, just a model instance from let's say const Provider = new mongoose.Schema({ notifications: [{}] })
Kev
@lineus
Jan 30 2018 19:43
@bybrunobarros if I'm following you ( big IF ) then this works for me gist. it's at least an array.
bin: grep version ../node_modules/mongoose/package.json
"version": "5.0.2"
Koby Picker
@JKobyP
Jan 30 2018 23:32
@lineus thank you for your offer of help
I think that my problem was that I didn't have ordering strictly enforced between seeder.disconnect() and mongoose.connect() (disconnecting after running the seeder, and then reconnecting in order to run the matching algorithm)
Now that I have it cleanly separated with proper use of async.series, it seems to be working consistently!
Setting 'bufferCommands: false' helped me debug a good bit