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

$center

1.4 新版功能.

This specifies a circle shape for the $within operator in geospatial queries. To define the bounds of a query using $center, you must specify:

  • the center point, and
  • the radius

Considering the following example:

db.collection.find( { location: { $within: { $center: [ [0,0], 10 ] } } } );

The above command returns all the documents that fall within a 10 unit radius of the point [0,0].

在 2.2.3 版更改: Before 2.2.3, a geospatial index must exist on a field holding coordinates before using any of the geolocation query operators. After 2.2.3, applications may use geolocation query operators without having a geospatial index; however, geospatial indexes will support much faster geospatial queries than the unindexed equivalents.

注解

A geospatial index must exist on a field and the field must hold coordinates before you can use any of the geolocation query operators.

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

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