$match stage getting error

I am trying to run this specific query
client['chat']['commissionLedger'].aggregate([{ $match : { 'commissionTo' : j}}])

but i am getting the error stating

client[‘chat’][‘commission’].aggregate([{ $match : { ‘commissionTo’ : ‘12345’}}])
^
SyntaxError: invalid syntax

I am new to community so please ignore if my question is not in format, sorry in advance

The python language is very picky.

Without the code block that surround the line of code that you share it is hard to tell. The best is to share the whole function.

But I would try a few things.

  1. use double quotes rather than single quotes
  2. put quotes around $match, in JS you may omit quotes for literal, python is better in this area

Please read Formatting code and log snippets in posts before posting more code or documents.