@@ -39,7 +39,7 @@ Access a Database
3939
4040Access a database by using dictionary-style access on your ``MongoClient`` instance.
4141
42- The following example accesses a database named " test_database" :
42+ The following example accesses a database named `` test_database`` :
4343
4444.. code-block:: python
4545
@@ -50,7 +50,7 @@ Access a Collection
5050
5151Access a collection by using dictionary-style access on an instance of your database.
5252
53- The following example accesses a collection named " test_collection" :
53+ The following example accesses a collection named `` test_collection`` :
5454
5555.. code-block:: python
5656 :emphasize-lines: 2
@@ -70,7 +70,7 @@ Create a Collection
7070Use the ``create_collection()`` method to explicitly create a collection in a
7171MongoDB database.
7272
73- The following example creates a collection called ``" example_collection" ``:
73+ The following example creates a collection called ``example_collection``:
7474
7575.. code-block:: python
7676 :emphasize-lines: 2
@@ -83,6 +83,36 @@ validation rules, by passing them in as keyword arguments. For a full list of
8383optional parameters, see the `create_collection() API documentation
8484<{+api-root+}pymongo/database.html#pymongo.database.Database.create_collection>`__.
8585
86+ Time Series Collection
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+ in which the documents' time field is 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:`pymongo-time-series` guide.
100+
101+ Capped Collection
102+ ~~~~~~~~~~~~~~~~~
103+
104+ You can create a capped collection that cannot grow beyond a specified memory size or
105+ document count. The following example creates a capped collection called
106+ ``example_capped_collection`` that has 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 :manual:`Capped Collections </core/capped-collections/>`
114+ in the {+mdb-server+} manual.
115+
86116Get a List of Collections
87117-------------------------
88118
0 commit comments