Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document mongoose.connections #7338

Closed
GarrettGeorge opened this issue Dec 14, 2018 · 1 comment
Closed

Document mongoose.connections #7338

GarrettGeorge opened this issue Dec 14, 2018 · 1 comment
Labels
docs This issue is due to a mistake or omission in the mongoosejs.com documentation
Milestone

Comments

@GarrettGeorge
Copy link

Do you want to request a feature or report a bug?

feature

What is the current behavior?

When trying to access the default connection mongoose.connection is a nice way for other files to access models via mongoose.model('Model'). However when you have multiple connections via createConnection there's no nice way for other files to access the model. Yes I know there's conn.useDb('asdf').model('Model') but that only works if the connection has been made and access to that conn object is done.

With the default connection this is trivial because mongoose.model doesn't care if the default connection is even up and running yet, but when you're trying to access a model that's been registered on a connection with createConnection it immediately checks if the model has been registered on that connection.

@vkarpov15
Copy link
Collaborator

We actually have a mongoose.connections property, it just isn't documented unfortunately. Will add.

@vkarpov15 vkarpov15 changed the title Have mongoose.connections server an array of connections from createConnection. Document mongoose.connections Dec 14, 2018
@vkarpov15 vkarpov15 added the docs This issue is due to a mistake or omission in the mongoosejs.com documentation label Dec 14, 2018
@vkarpov15 vkarpov15 added this to the 5.4.3 milestone Dec 14, 2018
@vkarpov15 vkarpov15 modified the milestones: 5.4.3, 5.4.4 Jan 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs This issue is due to a mistake or omission in the mongoosejs.com documentation
Projects
None yet
Development

No branches or pull requests

2 participants