Skip to content

Commit 83a9bd7

Browse files
authored
add info about ordered:false (#5712) (#5754)
* add info about ordered:false * adjust heading title * add keywords metadata
1 parent 8caa4ee commit 83a9bd7

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

source/core/timeseries/timeseries-best-practices.txt

+13-6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Best Practices for Time Series Collections
44

55
.. default-domain:: mongodb
66

7+
.. meta::
8+
:keywords: Time series, Best practices
9+
710
.. contents:: On this page
811
:local:
912
:backlinks: none
@@ -21,25 +24,27 @@ Optimize Inserts
2124
To optimize insert performance for time series collections, perform the
2225
following actions.
2326

24-
Batch Documents by Metadata
25-
~~~~~~~~~~~~~~~~~~~~~~~~~~~
27+
Batch Document Writes
28+
~~~~~~~~~~~~~~~~~~~~~
2629

2730
When inserting multiple documents:
2831

2932
- To avoid network roundtrips, use a single
3033
:method:`~db.collection.insertMany()` statement as opposed to
3134
multiple :method:`~db.collection.insertOne()` statements.
3235

33-
- If possible, order or construct batches to contain multiple
34-
measurements per series (as defined by metadata).
36+
- If possible, construct batches to contain multiple measurements per series
37+
(as defined by metadata).
38+
39+
- To improve performance, set the ``ordered`` parameter to ``false``.
3540

3641
For example, if you have two sensors, ``sensor A`` and ``sensor B``, a
3742
batch containing multiple measurements from a single sensor incurs the
3843
cost of one insert, rather than one insert per measurement.
3944

4045
The following operation inserts six documents, but only incurs the cost
4146
of two inserts (one per batch), because the documents are ordered by
42-
sensor:
47+
sensor. The ``ordered`` parameter is set to ``false`` to improve performance:
4348

4449
.. code-block:: javascript
4550

@@ -86,7 +91,9 @@ sensor:
8691
"timestamp": ISODate("2021-05-20T00:00:00.000Z"),
8792
"temperature": 26
8893
}
89-
] )
94+
], {
95+
"ordered": false
96+
})
9097

9198
Use Consistent Field Order in Documents
9299
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)