472096 (1) [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 (146) [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