Hi Jan,
On the contrary: one of the great things about MongoDB is that you can run it anywhere–on your laptop with MongoDB Community with the Atlas CLI’s local setup option, in the corporate data center with MongoDB Enterprise, and of course in the public cloud with MongoDB Atlas.
Using MongoDB locally, even offline or air-gapped, is a joy for developers everywhere!
You describe a web server hosted somewhere: ideally you’d host it in the same geographic region as your database.
Regarding performance: as a general rule, it’s important to understand that in the public cloud you’re talking about routnely making network calls that cross racks and availability zones in a physically specific region: the close proximity means network hops take <2ms… This is not significant for general purpose database performance use cases and has the major added advantage of a multi-availability zone posture for high availability including, for MongoDB replica sets in MongoDB Atlas, automatic failover. (Note there are some non-general purpose exceptions that are extremely latency intolerant–think high frequency trading and ad serving where you may optimize latency at the cost of high availability).
You should not see a material difference between running a web server locally connected to a local MongoDB instance and running the web server in the cloud connected to a nearby MongoDB Atlas cluster. However, depending on how you’re using the database, there can be some “gotchas” that manifest as a difference. For example if you’re not using authentication and TLS network encryption locally, you may notice that the time required to initiate a connection is lower than the TLS and auth handshake necessary to connect to a cluster in MongoDB Atlas… Sometimes folks find themselves pathologically opening and closing connections in their code, instead of re-using a connection pool. This is the kind of thing to “look out” for that could manifest as a meaningfully different performance experience in the cloud compared to local!
Hope that helps: and happy local development + remote cloud journeys ahead!
-Andrew