Aggify/aggify

filter issue when using __in with join field

mohamadkhalaj opened this issue · 1 comments

Input:

query.filter(deleted_at=None, owner__in=[123,456,789])

Desired output:

{
   '$match': {
      'deleted_at': None,
      'owner_id': {
         "$in": [123,456,789]
      }
   }
}

Aggify output:

{'$match': {'deleted_at': None}},
 {'$lookup': {'as': 'owner',
              'foreignField': '_id',
              'from': 'account',
              'localField': 'owner_id'}},
 {'$unwind': {'path': '$owner', 'preserveNullAndEmptyArrays': True}},
 {'$match': {'owner.in': [123, 456, 789]}}

Fixed