findOne: tell database to only return one
This commit is contained in:
parent
2c6905b45f
commit
3aaee6cf84
1 changed files with 1 additions and 1 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue