我在尝试用{$lte start $gte end}
查询obj时得到了这个错误代码,你能给我看一些用coda.datetime查询的示例吗?
IllegalArgumentException can't serialize class org.joda.time.DateTime org.bson.BasicBSONEncoder._putObjectField (BasicBSONEncoder.java:284)
功能:
(defn data->orders [start end]
(let [db (mg/get-db conn/mongo-db "db")
coll "coll"
formatter (f/formatter "YYYY-MM-dd")]
(mc/find-maps db coll
{:created_at
{$gte (f/parse formatter start)
$lte (f/parse formatter end)}})))
阅读http://clojuremongodb.info/articles/integration.html
添加到ns
(:require monger.joda-time)
参见来源:https://github.com/michaelklishin/monger/blob/master/src/clojure/monger/joda_time.clj