11.. _manual-timeseries-collection-limitations:
22
3- ==================================
4- Time Series Collection Limitations
5- ==================================
3+ ============================================
4+ Time Series Collection Notes and Limitations
5+ ============================================
66
77.. default-domain:: mongodb
88
@@ -59,14 +59,79 @@ To remove all documents from a collection, use the
5959
6060.. _timeseries-limitations-secondary-indexes:
6161
62- Secondary Indexes
63- ~~~~~~~~~~~~~~~~~
62+ Time Series Secondary Indexes
63+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6464
6565You can add :term:`secondary indexes <secondary index>` on the fields
6666specified as the ``timeField`` and the ``metaField``. If the field value
6767for the ``metaField`` field is a document, you can also create secondary
6868indexes on fields inside that document.
6969
70+ The following sections describe:
71+
72+ - Additional secondary indexes you can add.
73+
74+ - Secondary index limitations.
75+
76+ Time Series Secondary Indexes in MongoDB 5.3
77+ ````````````````````````````````````````````
78+
79+ Starting in MongoDB 5.3:
80+
81+ - You can add the following secondary indexes to a :ref:`time series
82+ collection <manual-timeseries-collection>`:
83+
84+ - :doc:`Partial
85+ </core/index-partial>`, :doc:`2d </core/2d>`, and :doc:`2dsphere
86+ </core/2dsphere>` indexes to a metadata field.
87+
88+ - :doc:`2dsphere </core/2dsphere>` and :doc:`partial
89+ </core/index-partial>` indexes to a measurement field.
90+
91+ - :doc:`Compound index </core/index-compound>` on time, metadata, or
92+ measurement fields.
93+
94+ - If you need to downgrade the Feature Compatibility Version (FCV),
95+ you must first drop any indexes that are incompatible with the
96+ downgraded FCV. See :dbcommand:`setFeatureCompatibilityVersion`.
97+
98+ - You can use the :query:`$or`, :query:`$in`, and :query:`$geoWithin`
99+ operators with :doc:`partial indexes </core/index-partial>` on a time
100+ series collection.
101+
102+ - You can use the :pipeline:`$geoNear` pipeline operator with a:
103+
104+ .. include:: /includes/geoNear-time-series.rst
105+
106+ For example, the following ``sensorData`` collection contains
107+ temperature readings:
108+
109+ .. code-block:: javascript
110+
111+ db.sensorData.insertMany( [
112+ {
113+ "metadata": { "sensorId": 5578, "type": "temperature" },
114+ "timestamp": ISODate("2022-01-15T00:00:00.000Z"),
115+ "temperatureReading": 12
116+ },
117+ {
118+ "metadata": { "sensorId": 5578, "type": "temperature" },
119+ "timestamp": ISODate("2022-01-15T04:00:00.000Z"),
120+ "temperatureReading": 11
121+ }
122+ ] )
123+
124+ The following example creates an ascending secondary index on the
125+ ``metadata.sensorId`` and ``temperatureReading`` fields in the
126+ ``sensorData`` collection:
127+
128+ .. code-block:: javascript
129+
130+ db.sensorData.createIndex( { "metadata.sensorId": 1, "temperatureReading": 1 } )
131+
132+ Secondary Index Limitations
133+ ```````````````````````````
134+
70135In MongoDB 5.1, the ``metaField`` doesn't support :doc:`text
71136</core/index-text>` indexes.
72137
@@ -79,9 +144,12 @@ types:
79144
80145Secondary indexes don't support the following index properties:
81146
147+ - :doc:`2d </core/2d>` in MongoDB 5.2 and lower
148+ - :doc:`2dsphere </core/2dsphere>` in MongoDB 5.2 and lower
82149- :doc:`TTL </core/index-ttl>`
83150- :doc:`Unique </core/index-unique>`
84- - :doc:`Partial </core/index-partial>`
151+ - :doc:`Partial </core/index-partial>` in MongoDB 5.2 and lower
152+ - :doc:`Multikey index </core/index-multikey>` on a measurement field
85153
86154``reIndex``
87155~~~~~~~~~~~
0 commit comments