kraih/mango — pull request #25 by alexbyk (2014-09-22 11:42:52+00:00)
Title: Remove defaults from query and fields methods

It isn't actually a commit, it's more like a question.
I try to use something like this in my models (check if a criteria was set and set a default one if was not).
sub default_query { {active => 1} }
sub load {
my ($self, $cursor) = @_;
# oops, empty hash is default, wich means find all
# $cursor->query($self->default_query) unless $cursor->query;
$cursor->query($self->default_query) unless $cursor->{query};
}

By default fields and query attributes are empty hashrefs, so it is impossible to check if query was set to "find any" or if it wasn't set yet. $cursor->{query} works for me, but I think this isn't the best way