Disclaimer: Clojure noob.
I'm trying to implement a simple get-shows
function to return upcoming shows from a MongoDB instance. This returns a LazySeq
of length 3, which is what I'd expect:
(defn get-shows []
(let [date-str (f/unparse (f/formatters :basic-date-time) (t/now))]
(mc/find-maps db "shows")))
But when I add a filter argument to the query, it returns an empty LazySeq
:
(defn get-shows []
(let [date-str (f/unparse (f/formatters :basic-date-time) (t/now))]
(mc/find-maps db "shows" {:date-time { $gte {$isoDate date-str} } })))
Am I using the wrong date format? Do I need to cast date-str
as an ISODate
in some other way?
I'm totally okay with storing/querying raw timestamps instead, especially if that simplifies the query, but I'm not sure how to do that in clj-time
...
You have probably solved this already, but did you try something like this: