Following query is running in MongoDB console correctly,
> db.venues.find({'location.region_id':ObjectId("533e67246d696e1279170000")}).count()
8
But when i write the same query in rails using mongoid its not showing anything, the query is as follows,
<%= Venue.where({'location.region_id' => '533e67246d696e1279170000'}).count %>
I don't know what's wrong with my query.
Convert the id to an ObjectId
object:
<%= Venue.where({'location.region_id' => BSON::ObjectId.from_string('533e67246d696e1279170000')}).count %>