Skip to content
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

DOCSP-43530: Id field in query results #3149

Merged
merged 6 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 4 additions & 3 deletions docs/query-builder.txt
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,10 @@ the value of the ``title`` field is ``"Back to the Future"``:

You can use the ``id`` alias in your queries to represent the
``_id`` field in MongoDB documents, as shown in the preceding
code. When you run a find operation using the query builder, {+odm-short+}
automatically converts between ``id`` and ``_id``. This provides better
compatibility with Laravel, as the framework assumes that each record has a
code. When you use the query builder to run a find operation, the {+odm-short+}
automatically converts between ``_id`` and ``id`` field names. In query results,
the ``_id`` field is presented as ``id``. This provides better
consistency with Laravel, as the framework assumes that each record has a
primary key named ``id`` by default.

Because of this behavior, you cannot have two separate ``id`` and ``_id``
Expand Down
7 changes: 4 additions & 3 deletions docs/upgrade.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,10 @@ This library version introduces the following breaking changes:
date classes, applying the default timezone.

- ``id`` is an alias for the ``_id`` field in MongoDB documents, and the library
automatically converts between ``id`` and ``_id`` when querying data. Because
of this behavior, you cannot have two separate ``id`` and ``_id`` fields in your
documents.
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.

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