Take the 2-minute tour ×

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

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

I think the problem is that your id is a string instead of being an ObjectId object. To create an ObjectId use the function object-id. Note that there is also a fetch-by-id fn

share|improve this answer
Aha. fetch-by-id also returns nil. What namespace should I include to use object-id –  VukBG Sep 29 '13 at 10:35
Sorry. It was my mistake. Forgot prefix I used when importing congomongo. Works now. Thanks –  VukBG Sep 29 '13 at 10:44
add comment

Your Answer


