Skip to content

Commit fe70f9d

Browse files
p-mongop
andauthored
Fix MONGOID-4772 Model.client_name not usable due to private visibility unlike collection_name/database_name (#4776)
Co-authored-by: Oleg Pudeyev <[email protected]>
1 parent ab4e5c1 commit fe70f9d

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

source/tutorials/mongoid-persistence.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,24 @@ However, MongoDB offers :ref:`multi-document transactions <transactions>`
522522
as of server version 4.0 which provide atomic persistence across multiple
523523
documents.
524524

525+
Persistence Context Attributes
526+
==============================
527+
528+
Mongoid provides ``client_name``, ``database_name`` and ``collection_name``
529+
methods on model classes to determine the client, database and collection names
530+
used for persistence:
531+
532+
.. code-block:: ruby
533+
534+
Band.client_name
535+
# => :default
536+
537+
Band.database_name
538+
# => "mongoid"
539+
540+
Band.collection_name
541+
# => :bands
542+
525543
Custom
526544
======
527545

0 commit comments

Comments
 (0)