Im making a server and need some way to be identified if mongojs connected successfully to the mongodb database when i call the function :
mongojs.connect(connectionString, collections);
Is there a callback or an event listener i could use?
Im making a server and need some way to be identified if mongojs connected successfully to the mongodb database when i call the function :
mongojs.connect(connectionString, collections);
Is there a callback or an event listener i could use?
As you can read in MongoJS docs (https://github.com/mafintosh/mongojs#events), there is one event which you can listen to know when the db is ready:
You need to make a variable assignment of the sentence you posted, as I show you below:
and then use the ready event to listen the db connection