CountDocuments is too slow on huge data (with proper indexes)

I am using mongoose with node Js.
Count operation is taking huge time with 15 million records taking around 1 minutes.

Aggregate Query : [{“$match”:{“createdAt”:{“$gte”:“2024-05-01T00:00:00.000Z”,“$lte”:“2024-05-16T00:00:00.000Z”},“user_id”:“62943f06a21bb047f3d42e0d”}},{“$count”:“count”}]

Another option tried : [{“$match”:{“createdAt”:{“$gte”:“2024-05-01T00:00:00.000Z”,“$lte”:“2024-05-16T00:00:00.000Z”},“user_id”:“62943f06a21bb047f3d42e0d”}},{$group: { _id: null, count: {$sum: 1}}}]

Have you indexed the createdAt and user_id fields within a compound index?

Yes, Index is there.