I have a feeling that you are mixing two concepts: filtering documents and returning subsets of documents.
Return a subset of documents
exclude mongo . , , : . , , . exclude only , exclude blacklists, only - .
Queryset:
data = Data.objects({'category':{'$ne':''}}).order_by('-datetime')[:500]
:
data = Data.objects(category__ne='').order_by('-datetime')[:500]
. .