Skip to content

Commit

Permalink
DOCSP-43806: getColumns id alias (#3165)
Browse files Browse the repository at this point in the history
* DOCSP-43806: getColumns id alias

* JT tech review 1
  • Loading branch information
rustagir authored Oct 1, 2024
1 parent 8318822 commit 5c7e240
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 represents
the ``_id`` field name in a MongoDB collection as the alias ``id`` in
the returned list of field names. You can pass either ``_id`` or
``id`` to the ``hasColumn()`` and ``hasColumns()`` methods.

Example
```````
Expand Down

0 comments on commit 5c7e240

Please sign in to comment.