code":50,"codeName":"MaxTimeMSExpired","errmsg":"operation exceeded time limit

how to fix this erorr

{“t”:{"$date":“2022-03-14T10:18:03.387+00:00”},“s”:“I”, “c”:“COMMAND”, “id”:51803, “ctx”:“conn3769”,“msg”:“Slow query”,“attr”:{“type”:“command”,“ns”:“NCCI.CLAIMS_EDIT_TRACKER_CL”,“appName”:“MongoDB Compass”,“command”:{“aggregate”:“CLAIMS_EDIT_TRACKER_CL”,“pipeline”:[{"$match":{“CreateDateTime”:{"$gte":{"$date":1633026600000}},"$and":[{“CreateDateTime”:{"$lte":{"$date":1640889000000}}}]}},{"$skip":0},{"$group":{"_id":1,“n”:{"$sum":1}}}],“cursor”:{},“maxTimeMS”:5000,“lsid”:{“id”:{"$uuid":“657da2a3-ec1e-4da4-863b-73b27a888ce0”}},"$db":“NCCI”},“planSummary”:“COLLSCAN”,“numYields”:9215,“queryHash”:“8D278A9B”,“planCacheKey”:“97C5B1A2”,“ok”:0,“errMsg”:“PlanExecutor error during aggregation :: caused by :: operation exceeded time limit”,“errName”:“MaxTimeMSExpired”,“errCode”:50,“reslen”:175,“locks”:{“Global”:{“acquireCount”:{“r”:9217}},“Mutex”:{“acquireCount”:{“r”:2}}},“remote”:“”,“protocol”:“op_msg”,“durationMillis”:5000}}

caused by :: operation exceeded time limit”,“errName”:“MaxTimeMSExpired”

any help apprecaited

Hello @Chinmaya_Das ,

Could you please provide me with below details to understand this context

  • What operation are you trying to do?
  • If it’s aggregation, please post the pipeline
  • It seems that you are using Compass. If this is correct, kindly provide Compass version
  • In the logs, there is a COLLSCAN mentioned there which is a collection scan, meaning the server must read all the documents in the collection to answer the query. This is typically the cause of a slow query. You might want to read this Documentation and create index to support the query to eliminate the COLLSCAN stage and hopefully make the query go faster.


1 Like

db.adminCommand( { setParameter: 1, maxTransactionLockRequestTimeoutMillis: 60000 });

after executing above command, problem solved

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.