1
我正在嘗試使用mongomapper做'內部'查詢。當我在shell執行命令,一切工作正常:mongomapper geospatial'within'查詢
box = [[32.476750,-117.246094],[32.850173,-116.806641]]
db.locations.find({"location" : {"$within" : {"$box" : box}}})
// Bunch of results
然而,當我運行軌道控制檯一樣,我得到零:
box = [[32.476750,-117.246094],[32.850173,-116.806641]]
Location.find(:location => {"$within" => {"$box" => box}})
=> nil
如果我做Location.first我得到一個位置回來,所以我知道我指的是正確的數據庫集合。我做錯了我的mongomapper查詢返回0結果?