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

Why Models in differenct dbs share namespace? #1209

Closed
wclr opened this issue Nov 12, 2012 · 3 comments
Closed

Why Models in differenct dbs share namespace? #1209

wclr opened this issue Nov 12, 2012 · 3 comments

Comments

@wclr
Copy link

wclr commented Nov 12, 2012

If I have different db connections (for example one default: mongoose, and one custom: db)

and create models:

first:
Book = mongoose.model('Book', BookSchema)

then:
Book2 = db.model('Book', BookSchema2)

Book2 would actually have BookSchema (not BookSchema2) schema, if I call model Book2 it works
Book2 = db.model('Book2', BookSchema2)
(but then I need to point out the collection name because it is books, not book2s)

Why is this?

@aheckmann
Copy link
Collaborator

if i'm following you correctly its a bug. Book2 should be using the BookSchema2, not BookSchema.

@wclr
Copy link
Author

wclr commented Nov 14, 2012

So it is.

@aheckmann
Copy link
Collaborator

relates to #1211

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants