How can ı creat queryset from commandcursor

I combined 2 different collections using aggregation and it returned me as commandcursor object and how do i query into it like i do a normal collection.

For example:

results = Account.objects(**query) 

this is normal using for me but ı use this aggregation

result = Account.objects.aggregate(
        [{'$lookup': {
            'from': 'users',
            'localField': '_id',
            'foreignField': 'account',
            'as': 'users'}}])

and ı want add query into this result

1 Like