diff --git a/docs/fundamentals/database-collection.txt b/docs/fundamentals/database-collection.txt index 826e43220..a453d81a9 100644 --- a/docs/fundamentals/database-collection.txt +++ b/docs/fundamentals/database-collection.txt @@ -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 $, string $)``: checks if the specified field exists - in at least one document -- ``Schema::hasColumns(string $, string[] $)``: checks if each specified field exists - in at least one document +- ``Schema::hasColumn(string $, string $)``: + checks if the specified field exists in at least one document +- ``Schema::hasColumns(string $, string[] $)``: + 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 ```````