Show top 10 records in mongo db collection

I am using this query locally to get the top 10 records. Locally it is running fine but when I copy paste the same code in the metabase compiler it gives an error

I get that we need to modify it according to metabase syntax for running MongoDB and remove the aggregate clause. The query does run but it does not filter the top 10 values.

I figured it out myself. Added this within the clause/

            "$limit": 20