Querying is done using QuerySet as described before in update and delete operations.
Some convenience methods available are:
- all()
- count()
- first()
- exclude(*fields) to exclude some fields from the result
- only(*fields) to include only some fields in the result (this can be chained for a union of fields)
- limit(limit)
- order_by(ordering)
- reverse() if we want to reverse the order_by() order
- skip(number)
- values() to return Python dict instances instead of model instances
By using raw(), we can use the same queries that we described in the PyMongo section before for querying and still exploit the flexibility and convenience methods provided by the ODM layer.