Docs 菜单
Docs 主页
/
数据库手册
/ / / /

2dsphere 索引版本

在此页面上

  • 更改索引版本

2dsphere 索引有以下版本:

2dsphereIndexVersion
说明

版本 3

MongoDB 3.2 引入了 2dsphere 索引第 3 版。 版本 3 是在 MongoDB 3.2 及更高版本中创建的 2dsphere 索引的默认版本。

版本 2

MongoDB 2.6 引入了 2dsphere 索引版本 2。 版本 2 是在 MongoDB 2.6 到 3.0 中创建的 2dsphere 索引的默认版本。

版本 1

MongoDB 2.4 引入了 2dsphere 索引版本 1。 MongoDB 2.4 仅支持版本 1。

重要

尽可能始终使用默认索引版本。 仅在出于兼容性原因需要时才覆盖默认版本。

要覆盖默认版本并为 2dsphere 索引指定不同版本,请在创建索引时设置 2dsphereIndexVersion选项:

db.<collection>.createIndex(
{ <field>: "2dsphere" },
{ "2dsphereIndexVersion": <version> }
)

以下命令在address字段上创建版本 2 2dsphere 索引:

db.test.createIndex(
{ "address": "2dsphere" },
{ "2dsphereIndexVersion": 2 }
)

后退

球体中的圆

在此页面上