太陽黒点を検索に使用するモンゴイド RoR アプリがあります。
座標をモンゴイド文書に保存して検索可能にするにはどうすればよいですか?
それらを配列に格納し、フィールドにインデックスを付け、ここに示す地理空間メソッドでクエリを実行します: http://mongoid.org/en/origin/docs/selection.html#symbol
例えば:
class Doc
include Mongoid::Document
field :location, type: Array
index({ location: "2d" }, { min: -200, max: 200 })
end
次のように呼び出します。
Doc.within_circle(location: ...)