Skip to content

Commit

Permalink
DOCSP-43806: getColumns id alias
Browse files Browse the repository at this point in the history
  • Loading branch information
rustagir committed Sep 30, 2024
1 parent 7a865e7 commit 49e44a0
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions docs/fundamentals/database-collection.txt
Original file line number Diff line number Diff line change
Expand Up @@ -258,16 +258,21 @@ schema builder method in your application.
You can also use the following methods to return more information about the
collection fields:

- ``Schema::hasColumn(string $<collection>, string $<field name>)``: checks if the specified field exists
in at least one document
- ``Schema::hasColumns(string $<collection>, string[] $<field names>)``: checks if each specified field exists
in at least one document
- ``Schema::hasColumn(string $<collection>, string $<field name>)``:
checks if the specified field exists in at least one document
- ``Schema::hasColumns(string $<collection>, string[] $<field names>)``:
checks if each specified field exists in at least one document

.. note::
MongoDB is a schemaless database, so the preceding methods query the collection
data rather than the database schema. If the specified collection doesn't exist
or is empty, these methods return a value of ``false``.

.. note:: id Alias

MongoDB is a schemaless database, so the preceding methods query the collection
data rather than the database schema. If the specified collection doesn't exist
or is empty, these methods return a value of ``false``.
Starting in {+odm-long+} v5.1, the ``getColumns()`` method returns
the ``_id`` field name as the alias ``id``. You can pass either
``_id`` or ``id`` to the ``hasColumn()`` and ``hasColumns()``
methods.

Example
```````
Expand Down

0 comments on commit 49e44a0

Please sign in to comment.