I've been searching for this for so many hours. Everytime I call the 'near' method on my Model, it gives the following error:
2.0.0p247 :001 > Status.near(@coordinates, 10).to_a
Moped::Errors::QueryFailure: The operation: #<Moped::Protocol::Query
@length=157
@request_id=3
@response_to=0
@op_code=2004
@flags=[:slave_ok]
@full_collection_name="howsmycity_development.statuses"
@skip=0
@limit=0
@selector={"deleted_at"=>nil, "coordinates"=>{"$nearSphere"=>[74.3344609, 31.5130751], "$maxDistance"=>0.002526046147566618}}
@fields=nil>
failed with error 13038: "can't find any special indices: 2d (needs index), 2dsphere (needs index), for: { deleted_at: null, coordinates: { $nearSphere: [ 74.3344609, 31.5130751 ], $maxDistance: 0.002526046147566618 } }"
I've already tried running: rake db:mongoid:create_indexes
Using Ruby 2, Rails 4, Mongoid 4, MongoDB 2.4.4 and Geocoder 1.1.8. And BTW I'm using Mongoid-Paranoia Gem too. I've also tried pointing all gems to their github repos with no luck. I've opened an issue here as well.
Any help appreciated.