Skip to content

Commit 4363a4a

Browse files
jason-price-mongodbjason-price-mongodb
andauthored
DOCSP-34017-bucket-rounding-seconds (BACKPORT) (#5327)
* DOCSP-34017-bucket-rounding-seconds (#5262) * DOCSP-34017-bucket-rounding-seconds * DOCSP-34017-bucket-rounding-seconds * DOCSP-34017-bucket-rounding-seconds * DOCSP-34017-bucket-rounding-seconds --------- Co-authored-by: jason-price-mongodb <[email protected]> * DOCSP-34017-v7.0 --------- Co-authored-by: jason-price-mongodb <[email protected]>
1 parent 16cd120 commit 4363a4a

File tree

2 files changed

+44
-34
lines changed

2 files changed

+44
-34
lines changed

source/core/timeseries/timeseries-granularity.txt

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ Set Granularity for Time Series Data
66

77
.. default-domain:: mongodb
88

9+
.. facet::
10+
:name: genre
11+
:values: reference
12+
913
.. contents:: On this page
1014
:local:
1115
:backlinks: none
@@ -42,8 +46,9 @@ To retrieve current collection values, use the
4246

4347
db.runCommand( { listCollections: 1 } )
4448

45-
For time series collections, the output contains
46-
``granularity``, ``bucketMaxSpanSeconds``, and ``bucketRoundingSeconds`` fields, if present.
49+
For time series collections, the output contains ``granularity``,
50+
``bucketMaxSpanSeconds``, and ``bucketRoundingSeconds`` parameters, if
51+
present.
4752

4853
.. code-block:: javascript
4954
:copyable: false
@@ -74,8 +79,8 @@ For time series collections, the output contains
7479
}
7580

7681

77-
Using the "granularity" Field
78-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
82+
Using the "granularity" Parameter
83+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7984

8085
The following table shows the maximum time interval included in one
8186
bucket of data when using a given ``granularity`` value:
@@ -135,12 +140,12 @@ value, and do not set ``granularity``:
135140
interval to set the minimum time for the bucket.
136141

137142
For the weather station example with 5 minute sensor intervals, you
138-
could fine tune bucketing by setting the custom bucketing parameters to
143+
could adjust bucketing by setting the custom bucketing parameters to
139144
300 seconds, instead of using a ``granularity`` of ``"minutes"``:
140145

141146
.. code-block:: javascript
142147

143-
db. createCollection(
148+
db.createCollection(
144149
"weather24h",
145150
{
146151
timeseries: {
@@ -163,11 +168,12 @@ You can increase ``timeseries.granularity`` from a shorter unit of time
163168
to a longer one using a :dbcommand:`collMod` command.
164169

165170
.. code-block:: javascript
171+
:copyable: false
166172

167-
db.runCommand({
173+
db.runCommand( {
168174
collMod: "weather24h",
169-
timeseries: { granularity: "seconds" || "minutes" || "hours" }
170-
})
175+
timeseries: { granularity: "seconds" | "minutes" | "hours" }
176+
} )
171177

172178
If you are using the custom bucketing parameters
173179
``bucketRoundingSeconds`` and ``bucketMaxSpanSeconds`` instead of
@@ -176,13 +182,13 @@ command and set them to the same value:
176182

177183
.. code-block:: javascript
178184

179-
db.runCommand({
185+
db.runCommand( {
180186
collMod: "weather24h",
181187
timeseries: {
182-
bucketRoundingSeconds: "86400",
183-
bucketMaxSpanSeconds: "86400"
188+
bucketRoundingSeconds: 86400,
189+
bucketMaxSpanSeconds: 86400
184190
}
185-
})
191+
} )
186192

187193
You cannot decrease the granularity interval or the custom bucketing
188194
values.

source/reference/command/collMod.txt

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ collMod
44

55
.. default-domain:: mongodb
66

7+
.. facet::
8+
:name: genre
9+
:values: reference
10+
711
.. contents:: On this page
812
:local:
913
:backlinks: none
@@ -24,7 +28,7 @@ Definition
2428

2529
.. note::
2630

27-
The view modified by this command does not refer to materialized
31+
The view modified by ``collMod`` does not refer to materialized
2832
views. For discussion of on-demand materialized views, see
2933
:pipeline:`$merge` instead.
3034

@@ -34,6 +38,7 @@ Syntax
3438
The command has the following syntax:
3539

3640
.. code-block:: javascript
41+
:copyable: false
3742

3843
db.runCommand(
3944
{
@@ -147,11 +152,12 @@ Change Index Properties
147152
change:
148153

149154
.. code-block:: javascript
155+
:copyable: false
150156

151157
db.runCommand( {
152158
collMod: <collection>,
153159
index: {
154-
keyPattern: <index_spec> || name: <index_name>,
160+
keyPattern: <index_spec> | name: <index_name>,
155161
expireAfterSeconds: <number>, // Set the TTL expiration threshold
156162
hidden: <boolean>, // Change index visibility in the query planner
157163
prepareUnique: <boolean>, // Reject new duplicate index entries
@@ -273,10 +279,11 @@ Modify Time Series Collections
273279
value:
274280

275281
.. code-block:: javascript
282+
:copyable: false
276283

277284
db.runCommand( {
278285
collMod: <collection>,
279-
expireAfterSeconds: <number> || "off"
286+
expireAfterSeconds: <number> | "off"
280287
} )
281288

282289
Set ``expireAfterSeconds`` to ``"off"`` to disable automatic removal,
@@ -293,11 +300,12 @@ Modify Time Series Collections
293300
series collection, you can increase ``timeseries.granularity`` from a shorter unit of time to a longer one:
294301

295302
.. code-block:: javascript
303+
:copyable: false
296304

297-
db.runCommand({
305+
db.runCommand( {
298306
collMod: "weather24h",
299-
timeseries: { granularity: "seconds" || "minutes" || "hours" }
300-
})
307+
timeseries: { granularity: "seconds" | "minutes" | "hours" }
308+
} )
301309

302310
To update the custom bucketing parameters ``bucketRoundingSeconds``
303311
and ``bucketMaxSpanSeconds`` instead of ``granularity``, include both
@@ -306,14 +314,14 @@ Modify Time Series Collections
306314

307315
.. code-block:: javascript
308316

309-
db.runCommand({
317+
db.runCommand( {
310318
collMod: "weather24h",
311319
timeseries: {
312-
bucketRoundingSeconds: "86400",
313-
bucketMaxSpanSeconds: "86400"
320+
bucketRoundingSeconds: 86400,
321+
bucketMaxSpanSeconds: 86400
314322
}
315-
})
316-
323+
} )
324+
317325
You cannot decrease the granularity interval or the custom bucketing
318326
values.
319327

@@ -366,6 +374,7 @@ For example, the following command sets the maximum size of a capped collection
366374
to 100000 bytes and sets the maximum number of documents in the collection to 500:
367375

368376
.. code-block:: javascript
377+
:copyable: false
369378

370379
db.runCommand( {
371380
collMod: <collection>,
@@ -456,19 +465,15 @@ the following privilege to run the ``collMod`` command:
456465
:header-rows: 1
457466

458467
* - Task
459-
460468
- Required Privileges
461469

462470
* - Modify a non-capped collection
463-
464471
- :authaction:`collMod` in the database
465472

466473
* - Modify a view
467-
468474
- :authaction:`collMod` in the database and either:
469475

470476
- no :authaction:`find` on the view to modify, **or**
471-
472477
- both :authaction:`find` on the view to modify and
473478
:authaction:`find` on the source collection/view.
474479

@@ -530,13 +535,13 @@ planner.
530535

531536
.. code-block:: javascript
532537

533-
db.runCommand({
538+
db.runCommand( {
534539
collMod: "orders",
535540
index: {
536541
keyPattern: { shippedDate: 1 },
537542
hidden: true
538543
}
539-
})
544+
} )
540545

541546
If successful, the operation returns a document that includes both the
542547
old and new value for the changed property:
@@ -548,7 +553,7 @@ old and new value for the changed property:
548553
.. note::
549554

550555
If the operation is successful but the ``hidden`` value has not
551-
changed (i.e. hiding an already hidden index or unhiding an already
556+
changed (specifically, hiding an already hidden index or unhiding an already
552557
unhidden index), the command omits the ``hidden_old`` and
553558
``hidden_new`` fields from the output.
554559

@@ -561,7 +566,6 @@ To hide a text index, you must specify the index by ``name`` and not by
561566
- :method:`db.collection.hideIndex()`
562567
- :method:`db.collection.unhideIndex()`
563568

564-
565569
Convert an Existing Index to a Unique Index
566570
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
567571

@@ -620,7 +624,7 @@ converting the index:
620624
keyPattern: { type: 1 },
621625
unique: true
622626
}
623-
} )
627+
} )
624628

625629
The response to this operation varies by driver. You will always
626630
receive an error message about the duplicate entries.
@@ -654,4 +658,4 @@ entries:
654658
}
655659

656660
To complete the conversion, modify the duplicate entries to remove any
657-
conflicts and re-run ``collMod()`` with the ``unique`` option.
661+
conflicts and re-run ``collMod()`` with the ``unique`` option.

0 commit comments

Comments
 (0)