Slow total number of documents using attribute pattern

I’ve been running an M40 instance on MongoDB Atlas and a local MongoDB server on my M1 Macbook. Both servers have the same poor performance.