0

I have simple app that should return single record from Mongo database.

(def movie (m/fetch-one :movie
                        :where {:_id id}))

id is correct but i keep getting nil as a return from this. Here is how my :_id looks like

:_id #<ObjectId 5245ca7d44aed3e864a1c830>

I guess my problem is here somewhere, but I just don't have enough experience with Clojure to find an error

In this case id passed to where is 5245ca7d44aed3e864a1c830

4

1 回答 1

1

我认为问题在于您的 id 是一个字符串,而不是一个 ObjectId 对象。要创建 ObjectId,请使用函数object-id。注意还有一个fetch-by-idfn

于 2013-09-29T00:03:29.837 回答