This is my attempt at making the DB instance a singleton pattern.
The GetCollection function calls ConnectDB everytime its invoked - but the sync package's once.do should prevent from any more instances being created and just return the client from what I understood of documentation. I hope this does the job, if not please let me know what I can change/improve!
This is my attempt at making the DB instance a singleton pattern.
The GetCollection function calls ConnectDB everytime its invoked - but the sync package's once.do should prevent from any more instances being created and just return the client from what I understood of documentation. I hope this does the job, if not please let me know what I can change/improve!