Skip to content

Commit 0e82bca

Browse files
nvillahermosa-mdbjason-price-mongodb
andcommitted
DOCS-15617-TLS-metrics-and-move-others-to-6.2 (#1886)
* DOCS-15617-TLS-metrics-and-move-others-to-6.2 * DOCS-15617-TLS-metrics-and-move-others-to-6.2 * DOCS-15617-TLS-metrics-and-move-others-to-6.2 * DOCS-15617-TLS-metrics-and-move-others-to-6.2 * DOCS-15617-TLS-metrics-and-move-others-to-6.2 * DOCS-15617-TLS-metrics-and-move-others-to-6.2 Co-authored-by: jason-price-mongodb <[email protected]>
1 parent 7b9dc6a commit 0e82bca

File tree

1 file changed

+78
-16
lines changed

1 file changed

+78
-16
lines changed

source/reference/command/create.txt

Lines changed: 78 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ Syntax
2828

2929
The :dbcommand:`create` command has the following syntax:
3030

31-
.. note:: Starting in MongoDB 4.2
32-
33-
MongoDB removes the MMAPv1 storage engine and the MMAPv1 specific
34-
option ``flags`` for :dbcommand:`create`.
35-
3631
.. code-block:: javascript
3732

3833
db.runCommand(
@@ -42,7 +37,9 @@ The :dbcommand:`create` command has the following syntax:
4237
timeseries: {
4338
timeField: <string>,
4439
metaField: <string>,
45-
granularity: <string>
40+
granularity: <string>,
41+
bucketMaxSpanSeconds: <int>,
42+
bucketRoundingSeconds: <int>
4643
},
4744
expireAfterSeconds: <number>,
4845
clusteredIndex: <document>, // Added in MongoDB 5.3
@@ -107,27 +104,74 @@ The :dbcommand:`create` command has the following fields:
107104

108105
* - ``timeseries.granularity``
109106
- string
110-
- Optional. Possible values are ``"seconds"`` (default),
111-
``"minutes"``, and ``"hours"``. Set the granularity to the value
112-
that is the closest match to the time span between consecutive
113-
incoming measurements. Setting the ``granularity`` parameter
114-
accurately improves performance by optimizing how data in the time
115-
series collection is stored internally.
107+
108+
- Optional. Defaults to ``"seconds"`` if unset. If you set
109+
``granularity`` you must not set ``bucketMaxSpanSeconds`` or ``bucketRoundingSeconds``. Possible values are ``"seconds"`` (default),``"minutes"``, and ``"hours"``.
110+
111+
Set the granularity to the value that is the
112+
closest match to the time span between consecutive incoming
113+
measurements. Setting the ``granularity`` parameter accurately
114+
improves performance by optimizing how data in the time series
115+
collection is stored internally.
116+
117+
For more information on how granularity settings differ, see
118+
:ref:`timeseries-granularity`.
119+
120+
116121

117122
* - ``timeseries.bucketMaxSpanSeconds``
118-
- integer
119-
- .. include:: /includes/time-series/fact-bucket-max-span-description.rst
120123

124+
- string
125+
126+
- Optional. If unset, the collection uses ``"granularity":
127+
"seconds"`` by default. If you set ``bucketMaxSpanSeconds`` you
128+
must also set ``bucketRoundingSeconds``, and you must not set
129+
``granularity``. Possible values are any positive integer up to
130+
``31536000`` (inclusive).
131+
132+
Set the maximum range for timestamps within the same bucket.
133+
134+
If you use this setting and need to downgrade below MongoDB 6.3,
135+
use :dbcommand:`collMod` and set bucket ``granularity`` to
136+
``seconds``, ``minutes``, or ``hours`` before downgrading.
137+
138+
For more information on how granularity settings differ, see
139+
:ref:`timeseries-granularity`.
140+
141+
142+
121143
* - ``timeseries.bucketRoundingSeconds``
122-
- integer
123-
- .. include:: /includes/time-series/fact-bucket-rounding-description.rst
144+
145+
- string
146+
147+
- Optional. If unset, the collection uses ``"granularity":
148+
"seconds"`` by default. If you set ``bucketRoundingSeconds`` you
149+
must also set ``bucketMaxSpanSeconds``, and you must not set
150+
``granularity``. Possible values are any positive integer that is less than or equal to ``bucketMaxSpanSeconds``.
151+
152+
Set the rounding behavior used to determine the minimum timestamp value for a new bucket. For example, setting
153+
this to ``"3600"`` rounds down to the nearest hour. If the value
154+
``"2023-03-27T18:24:35Z"`` does not fit an existing bucket,
155+
MongoDB creates a new bucket with a minimum value of
156+
``"2023-03-27T18:00:00Z"``.
157+
158+
If you use this setting and need to downgrade below MongoDB 6.3,
159+
use :dbcommand:`collMod` and set bucket ``granularity`` to
160+
``seconds``, ``minutes``, or ``hours`` before downgrading.
161+
162+
For more information on how granularity settings differ, see
163+
:ref:`timeseries-granularity`.
164+
165+
124166

125167
* - ``expireAfterSeconds``
126168
- number
127169
- Optional. Specifies the seconds after which documents in a
128170
:term:`time series collection` or :term:`clustered collection`
129171
expire. MongoDB deletes expired documents automatically.
130172

173+
174+
131175
* - :ref:`clusteredIndex <create.clusteredIndex>`
132176
- document
133177
- .. _create.clusteredIndex:
@@ -403,6 +447,24 @@ for the past 24 hours, issue this command:
403447
}
404448
)
405449

450+
Alternately, to create the same collection but limit each bucket to
451+
timestamp values within the same hour, issue this command:
452+
453+
.. code-block:: javascript
454+
455+
db.createCollection(
456+
"weather24h",
457+
{
458+
timeseries: {
459+
timeField: "timestamp",
460+
metaField: "data",
461+
bucketMaxSpanSeconds: "3600",
462+
bucketRoundingSeconds: "3600"
463+
},
464+
expireAfterSeconds: 86400
465+
}
466+
)
467+
406468
.. note::
407469

408470
In this example ``expireAfterSeconds`` is specified as ``86400``

0 commit comments

Comments
 (0)