Slow Mongodb query on remote database server?


First time building a Meteor app (taking over a build actually) and I have a few performance issues.

I have two database calls in an Apollo resolver file. One of the calls is a simple count of the collection:

const total = Collection.find({}).count();

This call on the local dev machine takes 60ms to do on a collection that has 4916 documents and is 17.8mb in size.
If I run the localhost server but use an external database hosted on mLab (EU region, same as where I am) now the query takes ~5000ms to do.

If I build and deploy the website that’s hosted on Galaxy (Hosted in US-west, I know that will be a bit slower but that’s a different issue), the same query now takes ~6000ms. I understand that the ~1000ms may be down to the time taken for data to be transferred, but why does the scenario where I run the server on localhost but have the database connect to the one hosted on mLab suddenly takes 5 seconds to return something from a simple database call?

There is a much bigger issue with this that I’m trying to solve (aggregation query taking 16 seconds on server compared to 1.6s on localhost) but the simple count query is easier to describe the issue with and takes unoptimised aggregation query variable out of the question.

Any help appreciated.