发布于 2015-09-14 14:48:14 | 291 次阅读 | 评论: 0 | 来源: 网络整理

Synopsis

This document provides a collection of hard and soft limitations of the MongoDB system.

限制

BSON 文档

BSON Document Size

The maximum BSON document size is 16 megabytes.

The maximum document size helps ensure that a single document cannot use excessive amount of RAM or, during transmission, excessive amount of bandwidth. To store documents larger than the maximum size, MongoDB provides the GridFS API. See mongofiles and the documentation for your driver for more information about GridFS.

Nested Depth for BSON Documents

在 2.2 版更改.

MongoDB supports no more than 100 levels of nesting for BSON documents.

命名空间

Namespace Length

Each namespace, including database and collection name, must be shorter than 123 bytes.

Number of Namespaces

The limitation on the number of namespaces is the size of the namespace file divided by 628.

A 16 megabyte namespace file can support approximately 24,000 namespaces. Each index also counts as a namespace.

Size of Namespace File

Namespace files can be no larger than 2047 megabytes.

By default namespace files are 16 megabytes. You can configure the size using the nssize.

索引

Index Size

Indexed items can be no larger than 1024 bytes.

Number of Indexes per Collection

A single collection can have no more than 64 indexes.

Index Name Length

The names of indexes, including their namespace (i.e database and collection name) cannot be longer than 128 characters. The default index name is the concatenation of the field names and index directions.

You can explicitly specify an index name to the ensureIndex() helper if the default index name is too long.

Unique Indexes in Sharded Collections

MongoDB does not support unique indexes across shards, except when the unique index contains the full shard key as a prefix of the index. In these situations MongoDB will enforce uniqueness across the full key, not a single field.

See

为片式集合强制使用唯一密钥 for an alternate approach.

Number of Indexed Fields in a Compound Index

There can be no more than 31 fields in a compound index.

Capped Collections

Maximum Number of Documents in a Capped Collection

Capped collections can hold no more than 232 documents.

Replica Sets

Number of Members of a Replica Set

Replica sets can have no more than 12 members.

Number of Voting Members of a Replica Set

Only 7 members of a replica set can have votes at any given time. See can vote Non-Voting Members for more information

Sharded Clusters

Operations Unavailable in Sharded Environments

The group does not work with sharding. Use mapReduce or aggregate instead.

db.eval() is incompatible with sharded collections. You may use db.eval() with un-sharded collections in a shard cluster.

$where does not permit references to the db object from the $where function. This is uncommon in un-sharded collections.

The $isolated update modifier does not work in sharded environments.

$snapshot queries do not work in sharded environments.

Sharding Existing Collection Data Size

MongoDB only allows sharding an existing collection that holds fewer than 256 gigabytes of data.

注解

This limitation only applies to sharding collections that have existing data sets, and is not a limit on the size of a sharded collection.

Operations

Sorted Documents

MongoDB will only return sorted results on fields without an index if the sort operation uses less than 32 megabytes of memory.

2d Geospatial queries cannot use the $or operator
Cannot Kill Foreground Index Build

You cannot use db.killOp() to kill a foreground index build.

Naming Restrictions

Restrictions on Database Names

The dot (i.e. .) character is not permissible in database names.

Database names are case sensitive even if the underlying file system is case insensitive.

在 2.2 版更改: For MongoDB instances running on Windows.

In 2.2 the following characters are not permissible in database names:

/. "*<>:|?

See Restrictions on Database Names for Windows for more information.

Restriction on Collection Names

2.2 新版功能.

Collection names should begin with an underscore or a letter character, and cannot:

  • contain the $.
  • be an empty string (e.g. "").
  • contain the null character.
  • begin with the system. prefix. (Reserved for internal use.)

See Are there any restrictions on the names of Collections? and Restrictions on Collection Names for more information.

Restrictions on Field Names

Field names cannot contain dots (i.e. .), dollar signs (i.e. $), or null characters. See Dollar Sign Operator Escaping for an alternate approach.

最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务