Skip to content

Commit 3430333

Browse files
committed
DOCSP-43530: Id field in query results
1 parent 11fe1ef commit 3430333

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

docs/query-builder.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,8 @@ the value of the ``title`` field is ``"Back to the Future"``:
196196
You can use the ``id`` alias in your queries to represent the
197197
``_id`` field in MongoDB documents, as shown in the preceding
198198
code. When you run a find operation using the query builder, {+odm-short+}
199-
automatically converts between ``id`` and ``_id``. This provides better
199+
automatically converts between ``id`` and ``_id``. In query results
200+
the ``_id`` field is renamed to ``id``. This provides better
200201
compatibility with Laravel, as the framework assumes that each record has a
201202
primary key named ``id`` by default.
202203

docs/upgrade.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,10 @@ This library version introduces the following breaking changes:
115115
date classes, applying the default timezone.
116116

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

122123
- Removes support for the ``$collection`` property. The following code shows
123124
how to assign a MongoDB collection to a variable in your ``User`` class in

0 commit comments

Comments
 (0)