Fork me on GitHub
Ramon Rios12:03:05

(defn get-brio-nr
  [db cust]
  (println "cust on db " cust)
  (get-in db [::ogm-search-results cust :brio-nr]))
I have a customer and i would like to get the :brio-nr of the same customer that i passed as paramenter into the get-in. I'm getting a null instead and i have no idea of how to make this work

Pavel Klavík14:03:02

I think the problem might be with ::, which is the notation I find very confusing and do not use it. It adds the current namespace in front of the keyword. So maybe the data have a different namespace than the one in which this is called.

Pavel Klavík14:03:56

In general, if you have a similar problem, I would debug all steps of this path in the data:

(js/console.log cust db (get-in db [::ogm-search-results]) (get-in db [::ogm-search-results cust]) (get-in db [::ogm-search-results cust :brio-nr]))

Pavel Klavík14:03:17

Then you can see easily where is the problem.

Ramon Rios15:03:00

Thank you!! Let me check that

Ramon Rios12:03:23

Does someone could please give a insight?


@ramonp.rios we can't really give you any more insights without seeing the data you're passing in (the value of cust and db). All I can tell you is that there is some mismatch between your code and the actual structure of the data.


I would start by calling your get-brio-nr fn with some hard-coded data that you expect will return the right result. If you get an unexpected result, post the data here and we can try to help sort out the mismatch.