Skip to content

Commit aa25f10

Browse files
committed
DOCSP-46688: Add collection configuration sections
1 parent 0876f2f commit aa25f10

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

source/databases-collections.txt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,36 @@ validation rules, by passing them in as keyword arguments. For a full list of
8383
optional parameters, see the `create_collection() API documentation
8484
<{+api-root+}pymongo/database.html#pymongo.database.Database.create_collection>`__.
8585

86+
Time Series Collections
87+
~~~~~~~~~~~~~~~~~~~~~~~
88+
89+
Time series collections efficiently store sequences of measurements over a period of time.
90+
The following example creates a time series collection called ``"example_ts_collection"``
91+
with a time field called ``"timestamp"``:
92+
93+
.. code-block:: python
94+
95+
database = client["test_database"]
96+
database.create_collection("example_ts_collection", timeseries={"timeField": "timestamp"})
97+
98+
For more information about using time series data with {+driver-short+}, see the
99+
:ref:`time-series <pymongo-time-series>` guide.
100+
101+
Capped Collection
102+
~~~~~~~~~~~~~~~~~
103+
104+
Capped collections have a maximum size that prevent them from growing beyond a specified
105+
limit. The following example creates a capped collection called ``"example_capped_collection"``
106+
with a maximum size of 1000 bytes:
107+
108+
.. code-block:: python
109+
110+
database = client["test_database"]
111+
database.create_collection("example_capped_collection", capped=True, size=1000)
112+
113+
To learn more about capped collections, see the :manual:`Capped Collections </core/capped-collections/>`
114+
guide in the {+mdb-server+} manual.
115+
86116
Get a List of Collections
87117
-------------------------
88118

0 commit comments

Comments
 (0)