Calculating connection count and DB server type

How can I calculate the optimal total connection count from my service to the my mongo DB endpoint? Is there a basic formula based on expected number of queries per second and CPU and IO taken by each query?

Similarly, is there a formula to calculate the optimal database instance type/size to use based on traffic patterns and query characteristics (CPU, IO consumed or latency of query)?

Note: By instance type I mean similar to EC2 instance type which provides info on vCPU and memory (RAM)

I will be using this to create the connection pool in my service. I’m assuming that if my service has N hosts then per host the connection pool size need to be the total optimal connection count divided by N.