Mongoid and querying for embedded locations?

Mike, The feature you are requesting is called multi-location documents. It is not supported in the current stable release 1.8.2. This is available only from version 1.9.1.

And Querying is straightforward when use mongoid, its like this City. Near("stores. Location" => @location) And be careful when using near queries in multi-location documents, because the same document may be returned multiple times, since $near queries return ordered results by distance.

You can read more about this here. Use $within query instead to get the correct results Same query written using $within and $centerSphere EARTH_RADIUS = 6371 distance = 5 City. Where("stores.

Location" => {"$within" => {"$centerSphere" => @location, (distance. Fdiv EARTH_RADIUS)}}) Cheers.

Very helpful answer. Thank you. – Mike A Jul 12 at 17:09 Would querying a collection of Stores and referencing the Cities be faster?

– Mike A Jul 12 at 17:57 @Mike A, you don't have to worry about that. Its going to be same. – RameshVel Jul 12 at 20:27.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions