allowDiskUse:true not working

Hi @Prasanjit_Dutta,

Welcome to the MongoDB Community forums

As per the documentation, the limit for each aggregation pipeline stage is 100 MB. So, using allowDiskUse:true allows writing temporary files on disk when a pipeline stage exceeds the 100-megabyte limit. Starting in MongoDB 6.0, operations that require greater than 100 MB of memory automatically write data to temporary files by default.

So, here, I assume you are using a cluster < v6.0. Therefore, please ensure you are passing it syntactically correctly.

db.collectionName.aggregate
(
  [ { <aggregation pipeline stages> } ],
  { allowDiskUse: true }
);

In case your problem persists, please share the sample document and the aggregation pipeline so the community can better assist you.

Best regards,
Kushagra