如何使用Ruby on Rails – Mongoid进行嵌入式位置查询?
- 内容介绍
- 文章标签
- 相关推荐
本文共计342个文字,预计阅读时间需要2分钟。
我有一个模型:`City` 类继承自 `Mongoid::Document`,包含字段 `name` 和嵌入的 `stores`,使用 `index` 为 `[[stores.location], Mongoid::Geo2D]]`。`Store` 类也继承自 `Mongoid::Document`,包含字段 `name`、`location` 和 `type`(数组类型),并且嵌入在 `cities` 中。
本文共计342个文字,预计阅读时间需要2分钟。
我有一个模型:`City` 类继承自 `Mongoid::Document`,包含字段 `name` 和嵌入的 `stores`,使用 `index` 为 `[[stores.location], Mongoid::Geo2D]]`。`Store` 类也继承自 `Mongoid::Document`,包含字段 `name`、`location` 和 `type`(数组类型),并且嵌入在 `cities` 中。

