On this page本页内容
reIndex
timeField
and metaField
timeField
和metaField
的修改granularity
granularity
修正$out
和$merge
The maximum size of a measurement document is 4 MB.测量文档的最大大小为4MB。
Starting in MongoDB 5.1, you can perform some delete and update operations.从MongoDB 5.1开始,您可以执行一些删除和更新操作。
Delete commands must meet the following requirements:删除命令必须满足以下要求:
metaField
field values.metaField
值上匹配。justOne: false
or the deleteMany()
method.justOne:false
或deleteMany()
方法。Update commands must meet the following requirements:更新命令必须满足以下要求:
metaField
field values.metaField
值上匹配。metaField
field value.metaField
值。multi: true
or the updateMany()
method.multi:true
或updateMany()
方法。upsert: true
。In MongoDB 5.0, Time series collections only support insert operations and read queries. 在MongoDB 5.0中,时间序列集合只支持插入操作和读取查询。Updates and manual delete operations result in an error.更新和手动删除操作会导致错误。
To automatically delete old data, set up automatic removal (TTL).要自动删除旧数据,请设置自动删除(TTL)。
To remove all documents from a collection, use the 要从集合中删除所有文档,请使用drop()
method to drop the collection.drop()
方法删除集合。
You can add secondary indexes on the fields specified as the 可以在指定为timeField
and the metaField
. timeField
和metaField
的字段上添加二级索引。If the field value for the 如果metaField
field is a document, you can also create secondary indexes on fields inside that document.metaField
字段的字段值是文档,则还可以在该文档内的字段上创建二级索引。
In MongoDB 5.1, the 在MongoDB 5.1中,metaField
doesn't support text indexes.metaField
不支持text索引。
In MongoDB 5.0, the 在MongoDB 5.0中,metaField
doesn't support the following index types:metaField
不支持以下索引类型:
Secondary indexes don't support the following index properties:二级索引不支持以下索引属性:
reIndex
The 时间序列集合不支持reIndex
command is not supported for time series collections.reIndex
命令。
A time series collection can't be created as a capped collection.无法将时间序列集合创建为封顶集合。
A collection's type can only be set when creating the collection:只能在创建集合时设置集合的类型:
To move data from an existing collection to a time series collection, migrate data into a time series collection.要将数据从现有集合移动到时间序列集合,请将数据迁移到时间序列集合。
timeField
and metaField
timeField
和metaField
的修改You can only set a collection's 创建集合时,只能设置集合的timeField
and metaField
parameters when creating the collection. timeField
和metaField
参数。After creation these parameters can't be modified.创建后,无法修改这些参数。
granularity
granularity
修正Once the 一旦设置了granularity
is set it can only be increased by one level at a time. granularity
,一次只能增加一个级别。From 从"seconds"
to "minutes"
or from "minutes"
to "hours"
. "seconds"
到"minutes"
,或从"minutes"
到"hours"
。Other changes are not allowed. 不允许进行其他更改。If you need to change the 如果需要将granularity
from "seconds"
to "hours"
, first increase the granularity
to "minutes"
and then to "hours"
.granularity
从"seconds"
更改为"hours"
,请先将粒度增加到"minutes"
,然后再增加到"hours"
。
You cannot specify validation rules for time series collections.不能为时间序列集合指定校验规则。
Client-side field level encryption is not supported for time series collections.时间序列集合不支持客户端字段级加密。
Starting in MongoDB 5.1 (and 5.0.6), sharded time series collections are supported. 从MongoDB 5.1(和5.0.6)开始,支持分片时间序列集合。When using sharded time series collections, you cannot modify the 使用分片时间序列集合时,不能修改分片时间序列集合的granularity
of a sharded time series collection.granularity
。
In versions earlier than MongoDB 5.0.6, you cannot shard time series collections.在MongoDB 5.0.6之前的版本中,不能对时间序列集合进行分片。
Starting in MongoDB 5.2 (and 5.1.2, 5.0.6), you can run sharding administration commands (such as 从MongoDB 5.2(以及5.1.2、5.0.6)开始,可以在moveChunk
) on the system.buckets
collection.system.buckets
集合上运行分片管理命令(例如moveChunk
)。
In versions earlier than MongoDB 5.0.6, you cannot run sharding administration commands for sharded time series collections.在MongoDB 5.0.6之前的版本中,无法对分片时间序列集合运行分片管理命令。
MongoDB does not support creating zones for sharded time series collections.MongoDB不支持为分片时间序列集合创建区域。
When sharding time series collections, you can only specify the following fields in the shard key:对时间序列集合进行分片时,只能在分片键中指定以下字段:
metaField
metaField
metaField
的子字段timeField
You may specify combinations of these fields in the shard key. 您可以在shard key中指定这些字段的组合。No other fields, including 分片键模式中不允许使用其他字段,包括_id
, are allowed in the shard key pattern._id
。
When you specify the shard key:指定分片键时:
metaField
can be either a:可以是:
timeField
must be:必须是:
Avoid specifying only the 避免仅将timeField
as the shard key. timeField
指定为分片键。Since the 由于timeField
increases monotonically, it may result in all writes appearing on a single chunk within the cluster. timeField
是单调增加的,因此可能会导致所有写入都出现在集群内的单个块上。Ideally, data is evenly distributed across chunks.理想情况下,数据均匀分布在数据块中。
To learn how to best choose a shard key, see:要了解如何最好地选择分片键,请参阅:
$out
和$merge
The aggregation pipeline stages 聚合管道阶段$out
and $merge
can't output to time series collections.$out
和$merge
无法输出到时间序列集合。
You can't write to time series collections in transactions.无法在事务中写入时间序列集合。
Reads from time series collections are supported in transactions.事务中支持从时间序列集合读取数据。
Change streams are not supported for time series collections.时间序列集合不支持更改流。
Database Triggers are not supported for time series collections.时间序列集合不支持数据库触发器。
GraphQL API is not supported for time series collections.时间序列集合不支持GraphQL API。
Atlas Search is not supported for time series collections.时间序列集合不支持Atlas搜索。
Realm Sync is not supported for time series collections.时间序列集合不支持Realm Sync。