2014-10-16 78 views
1

當我試着用{$lte start $gte end}查詢obj時,我得到了這個錯誤代碼,你能告訴我一些使用coda.datetime查詢的示例嗎?查詢mongo用joda.time.datetime使用clojure-monger

IllegalArgumentException can't serialize class org.joda.time.DateTime org.bson.BasicBSONEncoder._putObjectField (BasicBSONEncoder.java:284) 

的FUNC:

(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)}}))) 

回答