Skip to content

Commit 5c7e240

Browse files
authored
DOCSP-43806: getColumns id alias (#3165)
* DOCSP-43806: getColumns id alias * JT tech review 1
1 parent 8318822 commit 5c7e240

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

docs/fundamentals/database-collection.txt

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -258,16 +258,21 @@ schema builder method in your application.
258258
You can also use the following methods to return more information about the
259259
collection fields:
260260

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

266-
.. note::
266+
MongoDB is a schemaless database, so the preceding methods query the collection
267+
data rather than the database schema. If the specified collection doesn't exist
268+
or is empty, these methods return a value of ``false``.
269+
270+
.. note:: id Alias
267271

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

272277
Example
273278
```````

0 commit comments

Comments
 (0)