Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d370221

Browse files
Merge 4.8 into 5.0 (#3066)
2 parents b0bb3a5 + 979cf52 commit d370221

16 files changed

+375
-355
lines changed

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file.
44
## [4.8.0] - next
55

66
* Add `Query\Builder::incrementEach()` and `decrementEach()` methods by @SmallRuralDog in [#2550](https://github.com/mongodb/laravel-mongodb/pull/2550)
7+
* Deprecate `Connection::collection()` and `Schema\Builder::collection()` methods by @GromNaN in [#3062](https://github.com/mongodb/laravel-mongodb/pull/3062)
78

89
## [4.7.0] - 2024年07月19日
910

‎docs/fundamentals/database-collection.txt‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ create a database connection to the ``animals`` database in the
5656

5757
.. code-block:: php
5858
:emphasize-lines: 1,8
59-
59+
6060
'default' => 'mongodb',
6161

6262
'connections' => [
@@ -77,7 +77,7 @@ The following example shows how to specify multiple database connections
7777
``plants`` databases:
7878

7979
.. code-block:: php
80-
80+
8181
'connections' => [
8282

8383
'mongodb' => [
@@ -145,23 +145,29 @@ Laravel retrieves results from the ``flowers`` collection:
145145

146146
Flower::where('name', 'Water Lily')->get()
147147

148+
.. note::
149+
150+
Starting in {+odm-short+} v4.8, the ``DB::collection()`` method
151+
is deprecated. As shown in the following example, you can use the ``DB::table()``
152+
method to access a MongoDB collection.
153+
148154
If you are unable to accomplish your operation by using an Eloquent
149-
model, you can access the query builder by calling the ``collection()``
155+
model, you can access the query builder by calling the ``table()``
150156
method on the ``DB`` facade. The following example shows the same query
151157
as in the preceding example, but the query is constructed by using the
152-
``DB::collection()`` method:
158+
``DB::table()`` method:
153159

154160
.. code-block:: php
155161

156162
DB::connection('mongodb')
157-
->collection('flowers')
163+
->table('flowers')
158164
->where('name', 'Water Lily')
159165
->get()
160166

161167
List Collections
162168
----------------
163169

164-
To see information about each of the collections in a database, call the
170+
To see information about each of the collections in a database, call the
165171
``listCollections()`` method.
166172

167173
The following example accesses a database connection, then

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /