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
docs(connections): add section on multi tenant #13449
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, though one question and one suggestion
const express = require('express'); | ||
const mongoose = require('mongoose'); | ||
|
||
mongoose.connect('mongodb://127.0.0.1:27017/main'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this still required here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, to highlight that you do still need to connect before using useDb()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from what i can tell, this code example does not use useDb
, and rather createConnection
and never the default connection itself
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a fair point, this mongoose.connect()
call could be confusing. I put it here because in a multi-tenant scenario you may use the default connection to look up tenants. But not necessarily, so we can remove that.
Co-authored-by: hasezoey <hasezoey@gmail.com>
docs(connections): remove unnecessary mongoose.connect() call
Fix #11187
Summary
We get lots of questions about multi tenant, so would be nice to have a section of the docs to point people to.
Examples