Closed waygee closed 9 years ago
I simplified twee.js to the following, and still getting what seems to be two connections in the log:
module.exports = {
"extensions": {
"Session": {
"module": "twee-session-extension"
},
"Mongoose": {
"module": "twee-mongoose-extension"
}
},
"options": {
"errorPages": {
"404": {
"viewTemplate": __dirname + "/../views/common/pages/404.html"
}
}
},
"extension": {
"twee-mongoose": {
"databases": {
"myBusiness": {
"connection": "mongodb://localhost/myBusiness"
}
}
}
}
}
Looking into this! Will push fix very soon
Yes I know why. Because during adding new databases in your application config you added two more connections to this one which is default: https://github.com/tweeio/twee-mongoose-extension/blob/master/index.js#L212
Do you think I should remove default connection from there? But definitely i'll remove connection details because don't know how to not rewrite dbName in open and error callbacks.. Do you know?
I was trying to figure out how to change the default mongo connection and override it. Is there a way to do this? If there is a way to override the default connection, could you clarify?
Just to overwrite default connection you can write this:
"test": { "connection": "your connection string", "options": {} }
Probably it could be better to use default
instead of test
, do you think?
Sorry for not understanding, what file would I write this in? Also, I thing default is definitely better.
You should write it in the same place where you did your changes.
module.exports = {
"extensions": {
"Session": {
"module": "twee-session-extension"
},
"Mongoose": {
"module": "twee-mongoose-extension"
}
},
"options": {
"errorPages": {
"404": {
"viewTemplate": __dirname + "/../views/common/pages/404.html"
}
}
},
"extension": {
"twee-mongoose": {
"databases": {
"test": {
"connection": "mongodb://localhost/myBusiness"
}
}
}
}
}
Ok I'll fix it to be default
right now.
ok, thanks for your help and quick answers.
Here is it new fix: https://github.com/tweeio/twee-mongoose-extension/blob/master/index.js#L212
Now you can replace test
with default
Just remove twee-mongoose-extension in node_modules and do npm install
once more.
Yes, that worked fine!
Thank you for giving it try I'm working hard every day to make it better Soon I'll post few improvements and sequelize and bookshelf integration Also more videos and examples will be :-)
Following the directions at: https://github.com/tweeio/twee-mongoose-extension, I made the following changes in my application/configs/twee.js
When I start up the application, I get the following:
Note, the last 3 entries, why are there 3 connections for anotherBusiness? Also, why is there no connection for myBusiness?