get find to not return _id

10 views
Skip to first unread message

Rich S

unread,
Aug 28, 2015, 7:43:06 PM8/28/15
to Monger, a Clojure MongoDB driver
I'm trying to use find to return explicit fields, and the _id field gets returned everytime regardless.  Possible to not return the _id or somehow make sure it is always returned as a string without having to traverse every doc looking for _ids?

        result (with-collection db "test"
                 (find {:foo "bar"})
                  (fields [:foo])
                 )]

Always returns foo and the _id

Thanks,

Rich


Michael Klishin

unread,
Aug 28, 2015, 7:46:57 PM8/28/15
to clojure...@googlegroups.com, Rich S
Always returning _id wasn’t intentional but it makes sense to me because
you need it more often than not.

Simply clojure.core/dissoc it. 
--
@michaelklishin, github.com/michaelklishin
Reply all
Reply to author
Forward
0 new messages