findOne: tell database to only return one

This commit is contained in:
Scott R. Parish 2010-01-18 19:36:10 -06:00
parent 2c6905b45f
commit 3aaee6cf84

View file

@ -262,7 +262,7 @@ find c col sel = query c col [] 0 0 sel []
-- | Query, but only return the first result, if any. -- | Query, but only return the first result, if any.
findOne :: Connection -> Collection -> Selector -> IO (Maybe BsonDoc) findOne :: Connection -> Collection -> Selector -> IO (Maybe BsonDoc)
findOne c col sel = do findOne c col sel = do
cur <- find c col sel cur <- query c col [] 0 (-1) sel []
el <- nextDoc cur el <- nextDoc cur
finish cur finish cur
return el return el