'Instead of returning Document instances, return either a specific
value or a tuple of values in order.
Can be used along with
:func:`~mongoengine.queryset.QuerySet.no_dereference` to turn off
dereferencing.
.. note:: This effects all results and can be unset by calling
``scalar`` without arguments. Calls ``only`` automatically.
:param fields: One or more fields to return instead of a Document.'

def scalar(self, *fields):

    queryset = self.clone()
    queryset._scalar = list(fields)
    if fields:
        queryset = queryset.only(*fields)
    else:
        queryset = queryset.all_fields()
    return queryset
