File tree Expand file tree Collapse file tree 1 file changed +25
-7
lines changed
docs/fundamentals/connection Expand file tree Collapse file tree 1 file changed +25
-7
lines changed Original file line number Diff line number Diff line change @@ -362,10 +362,28 @@ to ``_id`` for both top level and embedded fields when querying and
362362storing data.
363363
364364When using {+odm-long+} v5.3 or later, you can disable the automatic
365- conversion of ``id`` to ``_id`` for embedded documents. To do so, set
366- the ``renameEmbeddedIdField`` connection setting to ``false``, as
367- shown in the following code:
368-
369- .. code-block:: php
370-
371- DB::connection('mongodb')->setRenameEmbeddedIdField(false);
365+ conversion of ``id`` to ``_id`` for embedded documents. To do so,
366+ perform either of the following actions:
367+
368+ 1. Set the ``rename_embedded_id_field`` setting to ``false`` in your
369+ ``config/database.php`` file:
370+
371+ .. code-block:: php
372+ :emphasize-lines: 6
373+
374+ 'connections' => [
375+ 'mongodb' => [
376+ 'dsn' => 'mongodb+srv://mongodb0.example.com/',
377+ 'driver' => 'mongodb',
378+ 'database' => 'sample_mflix',
379+ 'rename_embedded_id_field' => false,
380+ // Other settings
381+ ],
382+ ],
383+
384+ #. Pass ``false`` to the ``setRenameEmbeddedIdField()`` method in your
385+ application:
386+
387+ .. code-block:: php
388+
389+ DB::connection('mongodb')->setRenameEmbeddedIdField(false);
You can’t perform that action at this time.
0 commit comments