1
1
.. _manual-timeseries-collection-limitations:
2
2
3
- ==================================
4
- Time Series Collection Limitations
5
- ==================================
3
+ ============================================
4
+ Time Series Collection Notes and Limitations
5
+ ============================================
6
6
7
7
.. default-domain:: mongodb
8
8
@@ -59,14 +59,79 @@ To remove all documents from a collection, use the
59
59
60
60
.. _timeseries-limitations-secondary-indexes:
61
61
62
- Secondary Indexes
63
- ~~~~~~~~~~~~~~~~~
62
+ Time Series Secondary Indexes
63
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
64
64
65
65
You can add :term:`secondary indexes <secondary index>` on the fields
66
66
specified as the ``timeField`` and the ``metaField``. If the field value
67
67
for the ``metaField`` field is a document, you can also create secondary
68
68
indexes on fields inside that document.
69
69
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
+
70
135
In MongoDB 5.1, the ``metaField`` doesn't support :doc:`text
71
136
</core/index-text>` indexes.
72
137
@@ -79,9 +144,12 @@ types:
79
144
80
145
Secondary indexes don't support the following index properties:
81
146
147
+ - :doc:`2d </core/2d>` in MongoDB 5.2 and lower
148
+ - :doc:`2dsphere </core/2dsphere>` in MongoDB 5.2 and lower
82
149
- :doc:`TTL </core/index-ttl>`
83
150
- :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
85
153
86
154
``reIndex``
87
155
~~~~~~~~~~~
0 commit comments