How to know MongoDB standalone (in our case) instance loaded data successfully?

We using MongoDB standalone instance for our product.

Problem :
Front-end do not know, How long it should wait for MongoDB server to get ready with stored data?

When MongoDB server starts in our environment, it takes few seconds to load data.
So, looking for a solution to know that MongoDB server has loaded all data and FE can start the communication.

Thanks for your support

Hi @Nand_Sharma1 welcome to the community!

First of all, please note that MongoDB is designed to be operated on a dedicated server, and it’s best to not run different server processes on the same node for performance and consistency purposes.

We using MongoDB standalone instance for our product.

A standalone node is not a recommended setup for a production environment. The basic recommended setup for MongoDB is a replica set.

As mentioned by the page Deploy a Standalone MongoDB Instance:

Use standalone instances for testing and development. Do not use these deployments for production systems as they lack replication and high availability. For all production deployments use replica sets. To learn about replica sets, see Deploy a Replica Set.

How long it should wait for MongoDB server to get ready with stored data?

This would depend on many things, many of them specific to your situation (e.g. disk speed, CPU speed, RAM size, how much data you have, whether a recovery is necessary, whether other processes are busy, or also starting up, etc.), so unfortunately I don’t really have a definite answer for this.

I guess once the server can respond to a hello command with isWritablePrimary: true, it is ready to accept writes and thus is ready to proceed with normal operation.

Best regards
Kevin

2 Likes

Hi Kevin,
Thanks for valuable inputs.
Command hello & isWritablePrimary are seems useful features I’m interested in.

Yes, I agree standalone MongoDB is not a suitable case study for using, but this is our business requirement.

Warm Regards
Nand