michaelklishin/monger — Issue #6: Query DSL equivalent of find-one
Author: tobyhede
Created: 2012-01-30 09:34:56+00:00
State: open

Mostly thinking aloud.

I have found myself using the query DSL to return single results instead of the collection/find-one syntax

(first (query/with-collection "people"
(query/find {:staff_ids some-id})
(query/limit 1)))

It all works, but wondering if there is a smart way of wrapping this case into the DSL?

Something like the following could add the limit by default and unwrap the result from the returned seq?

(query/with-collection "people"
(query/find-one {:staff_ids some-id}))