newbie question but I'm having trouble finding a definitive answer online
so far, I have been connecting to my mongodb in the let block of each of my function definitions.
(def mongo-uri "mongodb://<username:<password>@...")
(defn get-node [nodeid]
(let [_nodeid nodeid
uri mongo-uri
{:keys [conn db]} (mg/connect-via-uri uri)
ncoll "nodes"]
(mc/find-maps db ncoll {:_id _nodeid})
))
I found a few sources online that discuss how to reuse the connection but I am having trouble finding a example online that shows me how my function definitions can have access to the connection object if the let block is not nested inside the function definition.
For example:
Could you please help me find the correct syntax to use so that my functions can have access to reuse the connection?
I am very grateful for help you can offer.
All the best,
Ben