Skip to content

DOCSP-42956: Remove $collection support #3138

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

Merged
merged 7 commits into from
Sep 10, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions docs/upgrade.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ This library version introduces the following breaking changes:
of this behavior, you cannot have two separate ``id`` and ``_id`` fields in your
documents.

- Removes support for the ``$collection`` property and associated methods.
The following list contains the removed methods and provides alternative methods
that you can use to replace the functionality:

- ``Model::collection()``: use ``Model::table()``
- ``DB::collection()``: use ``DB::table()``
- ``Connection::collection()``: use ``Connection::table()``
- ``Schema::collection()``: use ``Schema::table()``
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually there is only 2 methods removed in MongoDB\Laravel\Connection and MongoDB\Laravel\Schema\Builder, where they can be used as instance method.

But they are exposed in the Laravel facades Illuminate\Support\Facades\DB and Illuminate\Support\Facades, which expose them as static method. (Yes, this is very confusing).

Suggested change
- ``Model::collection()``: use ``Model::table()``
- ``DB::collection()``: use ``DB::table()``
- ``Connection::collection()``: use ``Connection::table()``
- ``Schema::collection()``: use ``Schema::table()``
- ``DB::collection()``: use ``DB::table()``
- ``Schema::collection()``: use ``Schema::table()``

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay I see, updated! Should I mention the static methods here?


.. _laravel-breaking-changes-v4.x:

Version 4.x Breaking Changes
Expand Down
Loading