Skip to content

Commit

Permalink
Docs changes v5.1 (#3174)
Browse files Browse the repository at this point in the history
Adds raw() field conversions and Laravel Herd information
  • Loading branch information
norareidy authored Oct 11, 2024
1 parent 3955807 commit 9108d27
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
13 changes: 13 additions & 0 deletions docs/quick-start/download-and-install.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,19 @@ Download and Install the Dependencies
Complete the following steps to install and add the {+odm-short+} dependencies
to a Laravel web application.

.. tip::

As an alternative to the following installation steps, you can use Laravel Herd
to install MongoDB and configure a Laravel MongoDB development environment. For
more information about using Laravel Herd with MongoDB, see the following resources:

- `Installing MongoDB via Herd Pro
<https://herd.laravel.com/docs/1/herd-pro-services/mongodb>`__ in the Herd
documentation
- `Laravel Herd Adds Native MongoDB Support
<https://www.mongodb.com/developer/products/mongodb/laravel-herd-native-support/>`__
in the MongoDB Developer Center

.. procedure::
:style: connected

Expand Down
7 changes: 7 additions & 0 deletions docs/upgrade.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,19 @@ This library version introduces the following breaking changes:
- In query results, the library converts BSON ``UTCDateTime`` objects to ``Carbon``
date classes, applying the default timezone.

In v5.1, the library also performs this conversion to the ``Model::raw()``
method results before hydrating a Model instance.

- ``id`` is an alias for the ``_id`` field in MongoDB documents, and the library
automatically converts between ``id`` and ``_id`` when querying data. The query
result object includes an ``id`` field to represent the document's ``_id`` field.
Because of this behavior, you cannot have two separate ``id`` and ``_id`` fields
in your documents.

In v5.1, the library also performs this conversion to the ``Model::raw()``
method results before hydrating a Model instance. When passing a complex query
filter, use the ``DB::where()`` method instead of ``Model::raw()``.

- Removes support for the ``$collection`` property. The following code shows
how to assign a MongoDB collection to a variable in your ``User`` class in
older versions compared to v5.0:
Expand Down

0 comments on commit 9108d27

Please sign in to comment.