Skip to content

Commit

Permalink
MONGOID-4834 Capped collection documentation examples lack setup/cont…
Browse files Browse the repository at this point in the history
…ext (#5337)
  • Loading branch information
Neilshweky committed Jun 24, 2022
1 parent 4674f42 commit e0d3de9
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions docs/reference/collection-configuration.txt
Expand Up @@ -18,11 +18,20 @@ Mongoid does not provide a mechanism for creating capped collections on the fly
will need to create these yourself one time up front either with the driver or via the
Mongo console.

To create a capped collection with the driver:
To create a capped collection with the driver, first retrieve the client:

.. code-block:: ruby

client["name", :capped => true, :size => 1024].create
class Name
include Mongoid::Document
end
client = Name.collection.client

Then create the collection:

.. code-block:: ruby

client["names", :capped => true, :size => 1024].create

To create a capped collection from the Mongo console:

Expand Down

0 comments on commit e0d3de9

Please sign in to comment.