These are chat archives for Automattic/mongoose

Mar 2017
Mar 22 2017 12:58
@icehaunter why do you put 'let' and not 'var' ?
Ilya Borovitinov
Mar 22 2017 13:00
@Justintlai because let is the newer standard and its a good idea to use it everywhere you don't need var scoping explicitly
Mar 22 2017 13:01
@icehaunter ah i see, but does it work if you use var instead? I'm sure that's not the issue but good to know that :)
Ilya Borovitinov
Mar 22 2017 13:05
And you can use most of es6 features in latest node
No, it didn't work, because i had another mongoose instance, basically. Forgot to remove old code after refactoring
let is ES6 standard
Sorry, net problems
Mar 22 2017 13:12
ahh just read up on this. Thanks for sharing!
Paul "Joey" Clark
Mar 22 2017 14:08
@icehaunter @Justintlai You should use const everywhere you can. Fall back to let only when you need to re-assign that variable.
Pieter Steyaert
Mar 22 2017 14:53

Hi all,

potential noobie question, and it might be bad design.

Lets say I have a scheme (let's say party) that has a property called "events" which is an array of ObjectId's of an Event model.
Let's say that by using discrimination I have multiple "kinds" of models.

Ok, so when I want to populate the events of any instances of our "party scheme", I get as result only some form of population that is shared in the "parent" class of the Event model. And not specific properties that any derived (by discrimination) are stored in the DB.

I have a Scheme A, which has an array containing ObjectIDs of Model B, but they can refer to "subclasses" (by discrimination) of B; B1, B2,… and population of A-instances only populates B properties.

Can someone point me in the right direction?

Tabitha Blagdon
Mar 22 2017 16:10
Quick verification question on mongoose connection patterns - i'm sharding our mongoDB into two DB's - we had used mongoose.connect() as a default when we had one DB and will now need to use mongoose.createConnection() for two. Is it possible to use mongoose.createConnection() for one connection and have the other schemas default to the mongoose.connect() connection w/o override in same app? That will save a lot of time on refactoring. I'm assuming this isn't possible, but would appreciate verification or insights. Thanks!