michaelklishin/monger — Issue #8: find-one-as-map ignores fields selection 
Author: tobyhede
Created: 2012-02-12 04:29:31+00:00
State: open

Trying to

(let [collection "something" conditions {:_id id} :fields [:name, :something] ]
(collection/find-one-as-map collection conditions fields))

Interestingly, find-one returns a BasicDBObject with the correctly specified fields:

(collection/find-one collection conditions fields)

Looking at the current implementation, the 3-arity function accepts 'keywordize' rather than the 'fields' param.

([^String collection ^Map ref keywordize]
(from-db-object ^DBObject (find-one collection ref) keywordize))
([^String collection ^Map ref ^List fields keywordize]
(from-db-object ^DBObject (find-one collection ref fields) keywordize)))

find-maps accepts 'fields' as the 3rd parameter and have a keywordize at all.

I think these should be consistent, but what should the behaviour be?

Should the find-one param order be changed to accept field before keywordize?
Should keywordize be added to the other map functions?