Skip to content

Commit 96cae4e

Browse files
jason-price-mongodbjason-price-mongodb
andauthored
DOCSP-15476 reapply secondary indexes on time series metrics to 6 branch (#927)
* DOCSP-15476-reapply-secondary-indexes-on-time-series * DOCSP-15476-reapply-secondary-indexes-on-time-series-metrics-to-6-branch * DOCSP-15476-reapply-secondary-indexes-on-time-series-metrics-to-6-branch * DOCSP-18759-PIT-pre-post-images * DOCSP-15476-reapply-secondary-indexes-on-time-series-metrics-to-6-branch * DOCSP-15476-reapply-secondary-indexes-on-time-series-metrics-to-6-branch * DOCSP-15476-reapply-secondary-indexes-on-time-series-metrics-to-6-branch Co-authored-by: jason-price-mongodb <[email protected]>
1 parent c367d86 commit 96cae4e

File tree

7 files changed

+111
-10
lines changed

7 files changed

+111
-10
lines changed

source/core/timeseries/timeseries-limitations.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ To remove all documents from a collection, use the
8282

8383
.. _timeseries-limitations-secondary-indexes:
8484

85-
Secondary Indexes
86-
~~~~~~~~~~~~~~~~~
85+
Time Series Secondary Indexes
86+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8787

8888
You can add :term:`secondary indexes <secondary index>` on the fields
8989
specified as the ``timeField`` and the ``metaField``. If the field value
@@ -106,6 +106,11 @@ Secondary indexes don't support the following index properties:
106106
- :doc:`Unique </core/index-unique>`
107107
- :doc:`Partial </core/index-partial>`
108108

109+
For improvements to time series secondary indexes available starting in
110+
MongoDB 6.0, see :ref:`timeseries-add-secondary-index-mongodb-6.0`.
111+
112+
.. include:: /includes/time-series-secondary-indexes-downgrade-FCV.rst
113+
109114
Capped Collections
110115
~~~~~~~~~~~~~~~~~~
111116

source/core/timeseries/timeseries-secondary-index.txt

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.. _timeseries-add-secondary-index:
22

33
================================================
4-
Add Secondary Indexes on metaField and timeField
4+
Add Secondary Indexes to Time Series Collections
55
================================================
66

77
.. default-domain:: mongodb
@@ -53,6 +53,54 @@ series collection`, use :method:`cursor.hint()` with an index name:
5353

5454
db.weather24h.find({ "metadata.sensorId": 1235 }).hint("metadata.sensorId_1_timestamp_1")
5555

56-
On a time series collection, you can only specify hints using the index
57-
name, not the index key pattern. To get the names of the indexes on a
58-
collection, use the :method:`db.collection.getIndexes()` method.
56+
On a time series collection, you can specify hints using either the
57+
index name or the index key pattern. To get the names of the indexes on
58+
a collection, use the :method:`db.collection.getIndexes()` method.
59+
60+
.. _timeseries-add-secondary-index-mongodb-6.0:
61+
62+
Time Series Secondary Indexes in MongoDB 6.0
63+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
64+
65+
Starting in MongoDB 6.0:
66+
67+
- You can add a :doc:`compound index </core/index-compound>` on time,
68+
metadata, or measurement fields.
69+
70+
- You can use the :query:`$or`, :query:`$in`, and :query:`$geoWithin`
71+
operators with :doc:`partial indexes </core/index-partial>` on a time
72+
series collection.
73+
74+
- You can add :doc:`partial </core/index-partial>` and :doc:`2dsphere
75+
</core/2dsphere>` indexes on any field in a :ref:`time series
76+
collection <manual-timeseries-collection>`.
77+
78+
.. note::
79+
80+
.. include:: /includes/time-series-secondary-indexes-downgrade-FCV.rst
81+
82+
For example, the following ``sensorData`` collection contains
83+
temperature readings:
84+
85+
.. code-block:: javascript
86+
87+
db.sensorData.insertMany( [
88+
{
89+
"metadata": { "sensorId": 5578, "type": "temperature" },
90+
"timestamp": ISODate("2022-01-15T00:00:00.000Z"),
91+
"temperatureReading": 12
92+
},
93+
{
94+
"metadata": { "sensorId": 5578, "type": "temperature" },
95+
"timestamp": ISODate("2022-01-15T04:00:00.000Z"),
96+
"temperatureReading": 11
97+
}
98+
] )
99+
100+
The following example creates an ascending secondary index on the
101+
``metadata.sensorId`` and ``temperatureReading`` fields in the
102+
``sensorData`` collection:
103+
104+
.. code-block:: javascript
105+
106+
db.sensorData.createIndex( { "metadata.sensorId": 1, "temperatureReading": 1 } )
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
If there are :term:`secondary indexes <secondary index>` on :ref:`time
2+
series collections <manual-timeseries-collection>` and you need to
3+
downgrade the Feature Compatibility Version (FCV), you must first drop
4+
any secondary indexes that are incompatible with the downgraded FCV.
5+
See :dbcommand:`setFeatureCompatibilityVersion`.

source/reference/operator/aggregation/geoNear.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,15 @@ When using :pipeline:`$geoNear`, consider that:
206206
:ref:`let option <geoNear_let_example>` and
207207
:ref:`bound let option <geoNear_bounded_let_example>`.
208208

209+
- Starting in MongoDB 5.3, you can use the :pipeline:`$geoNear` pipeline
210+
operator on any field in a :ref:`time series collection
211+
<manual-timeseries-collection>`.
212+
213+
- Starting in MongoDB 6.0, you can create :doc:`partial
214+
</core/index-partial>` and :doc:`2dsphere </core/2dsphere>` indexes on
215+
any field in a :ref:`time series collection
216+
<manual-timeseries-collection>`.
217+
209218
Examples
210219
--------
211220

source/release-notes/5.3.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,13 @@ defragmented.
113113
General Improvements
114114
--------------------
115115

116+
Time Series Collection Improvements
117+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
118+
119+
Starting in MongoDB 5.3, you can use the :pipeline:`$geoNear` pipeline
120+
operator on any field in a :ref:`time series collection
121+
<manual-timeseries-collection>`.
122+
116123
Clustered Collections
117124
~~~~~~~~~~~~~~~~~~~~~
118125

source/release-notes/6.0-compatibility.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,8 @@ Compatibility Changes in MongoDB 6.0
1414

1515
The following 6.0 changes can affect compatibility with older
1616
versions of MongoDB.
17+
18+
Time Series Collections
19+
-----------------------
20+
21+
.. include:: /includes/time-series-secondary-indexes-downgrade-FCV.rst

source/release-notes/6.0.txt

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,35 @@ Release Notes for MongoDB 6.0
1212

1313
.. include:: /includes/in-dev.rst
1414

15-
.. toctree::
16-
:titlesonly:
17-
:hidden:
15+
.. _6.0-rel-notes-general:
1816

19-
/release-notes/6.0-compatibility
17+
General Improvements
18+
--------------------
19+
20+
Time Series Collection Improvements
21+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22+
23+
Starting in MongoDB 6.0, you can add additional :term:`secondary index
24+
<secondary index>` types to :ref:`time series collections
25+
<manual-timeseries-collection>`. See
26+
:ref:`timeseries-add-secondary-index-mongodb-6.0` for the additional
27+
indexes and other improvements.
2028

2129
.. _6.0-upgrade:
2230

2331
Upgrade Procedures
2432
------------------
33+
34+
Report an Issue
35+
---------------
36+
37+
To report an issue, see
38+
https://github.com/mongodb/mongo/wiki/Submit-Bug-Reports for
39+
instructions on how to file a JIRA ticket for the MongoDB server or one
40+
of the related projects.
41+
42+
.. toctree::
43+
:titlesonly:
44+
:hidden:
45+
46+
/release-notes/6.0-compatibility

0 commit comments

Comments
 (0)