Question: Say I have a mongoid document which has a field `:pairs` with the type of hash. When I wan't to query on the hash like this:

```
Doc.where(:pairs=>{"field1"=>1})

```

I get results back because I have in pairs a field with value one. I also have values for more than `1`. When I do the following, `nil` is returned:

```
Doc.where(:pairs=>{"field1"=>{"$gt"=>0}})

```

This doesn't seem to work, and I do have pairs with key `field1` and values bigger than `0`. Can anyone provide me info on why this doesn't work?

Answer: 
Just try: `Dco.where(:pairs.gt => 0)`   

For more detail mongoid querying see following link.  

<http://mongoid.org/en/mongoid/docs/querying.html>
```
Doc.where('pairs.field1' => {"$gt"=>1})

```