About an error "Sort exceeded memory limit of 33554432 bytes, but did not opt in to external sorting."

I’m fetching records in this i’m sorting, filtering while sorting for the last page of a pagination showing this error.
const AllLeads = await Leads.find(filter).sort(sort).skip(skip).limit(pageSize);
MongoServerError: Executor error during find command :: caused by :: Sort exceeded memory limit of 33554432 bytes, but did not opt in to external sorting. Aborting operation. Pass allowDiskUse:true to opt in.
at Connection.onMessage (D:\saikiranBPA\Backend\node_modules\mongodb\lib\cmap\connection.js:202:26)
at MessageStream. (D:\saikiranBPA\Backend\node_modules\mongodb\lib\cmap\connection.js:61:60)
at MessageStream.emit (node:events:519:28)
at processIncomingData (D:\saikiranBPA\Backend\node_modules\mongodb\lib\cmap\message_stream.js:124:16)
at MessageStream._write (D:\saikiranBPA\Backend\node_modules\mongodb\lib\cmap\message_stream.js:33:9)
at writeOrBuffer (node:internal/streams/writable:570:12)
at _write (node:internal/streams/writable:499:10)
at Writable.write (node:internal/streams/writable:508:10)
at TLSSocket.ondata (node:internal/streams/readable:1007:22)
at TLSSocket.emit (node:events:519:28) {
ok: 0,
code: 292,
codeName: ‘QueryExceededMemoryLimitNoDiskUseAllowed’,
‘$clusterTime’: {
clusterTime: new Timestamp({ t: 1727244979, i: 14 }),
signature: {
hash: Binary.createFromBase64(“RWRm+h3XpiRMedmOG9JWVoSduLs=”, 0),
keyId: new Long(“7382119106088009734”)
}
},
operationTime: new Timestamp({ t: 1727244979, i: 14 }),
[Symbol(errorLabels)]: Set(0) {}
} error