UTDNebula / nebula-api

The central API for Nebula Labs. Makes UTD data easily available through endpoints for both internal and public usage.
MIT License
26 stars 33 forks source link

Implement singleton pattern for MongoDB instance #214

Closed greeshiee closed 2 months ago

greeshiee commented 2 months ago

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!

jpahm commented 2 months ago

This looks good, thank you!