The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

472096 (6) [Avatar] Offline
#1
I did go for the multiple connection and choose .createConnection in stead of .connect. I think this more a simular to reality with for example a login database etc..

Half way chapter 6, p184 I tried to make connection but the server keeps hanging..

Via:
https://stackoverflow.com/questions/22786374/queries-hang-when-using-mongoose-createconnection-vs-mongoose-connect

I found out that mongoose.model() must change into db.model() to solve this.

So I change this everywhere mongoose.model is mentioned? Controllers? Locations.js in models map?

simon.holmes (148) [Avatar] Offline
#2
Hi

Yes, that's right. In this case the models aren't created against
mongoose
so can't be accessed that way - when you have separate connections the models can't be held in a shared reference as there's a possibility that you could have collections or schemas of the same name in two different databases.

Hope that helps.

Simon