-
Notifications
You must be signed in to change notification settings - Fork 1.5k
DOCSP-36792: Add default database connection admonition #2888
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
Changes from 5 commits
8a4ff94
9afca8e
d388d9e
969e338
75b6fc9
1e510fd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -22,7 +22,7 @@ Configure Your MongoDB Connection | |||||
|
||||||
.. code-block:: php | ||||||
|
||||||
'default' => env('DB_CONNECTION', 'mongodb'), | ||||||
'default' => 'mongodb', | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If people want to update their default connection, it might be in the env var There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line should set the default connection to MongoDB even if the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I remain convinced that this is the not the right way to change the default connection. @alcaeus any opinion? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Laravel's default configuration uses env variables, and I agree that we shouldn't deviate too far from this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, I changed these code snippets back to using env variables. Since we don't explain the .env file or its variables in the quick start, I made a ticket to add this info. |
||||||
|
||||||
Add the following highlighted ``mongodb`` entry to the ``connections`` array | ||||||
in the same file. Replace the ``<connection string>`` placeholder with the | ||||||
|
@@ -35,7 +35,7 @@ Configure Your MongoDB Connection | |||||
'connections' => [ | ||||||
'mongodb' => [ | ||||||
'driver' => 'mongodb', | ||||||
'dsn' => env('DB_URI', '<connection string>'), | ||||||
'dsn' => '<connection string>', | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As the connection string is likely to differ between environments (e.g. dev, staging, prod), we should stick with the Laravel default of providing this in an environment variable.
Suggested change
|
||||||
'database' => 'sample_mflix', | ||||||
], | ||||||
|
||||||
|
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.
This should mention that one should pass the connection name (for which we use "mongodb" in our examples). Also, I suggest using a code snippet for this purpose: