Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Update: I tried to test self hosted Mongo on basic Droplet and execution time is solid. Looks like the issue is in managed MongoDB.
Hey!
It sounds like that this could be just network latency, if you were running the statements from the server itself it would explain why you are seeing the same behavior on your localhost and on the Droplet that you’ve just created.
However, if you are running the statements from your local computer to the remote managed database, it would explain the few hundred milliseconds difference.
Basically, the physical distance between your MongoDB server in DigitalOcean’s data center and your current location might be contributing to increased response times. You could try to spin up a Droplet where you would be running your application on, and measure the execution time when running the statements from the Droplet to the Managed Database that are in the same region.
Let me know how it goes!
- Bobby