Extend database queries api with the posibility to define the sort
key of the field.