From a5ab7cdb6470f6331e0b2f90d63473bf43b32b17 Mon Sep 17 00:00:00 2001 From: "Scott R. Parish" Date: Sat, 16 Jan 2010 20:06:01 -0600 Subject: [PATCH] quickFind and quickFind' --- Database/MongoDB.hs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Database/MongoDB.hs b/Database/MongoDB.hs index 33a38e3..7785f27 100644 --- a/Database/MongoDB.hs +++ b/Database/MongoDB.hs @@ -27,7 +27,7 @@ module Database.MongoDB ( connect, connectOnPort, conClose, delete, insert, insertMany, query, remove, update, - find, + find, quickFind, quickFind', allDocs, allDocs', finish, nextDoc, Collection, FieldSelector, NumToSkip, NumToReturn, RequestID, Selector, Opcode(..), @@ -179,6 +179,15 @@ see 'query' -} find :: Connection -> Collection -> Selector -> IO Cursor find c col sel = query c col [] 0 0 sel Nothing +{- | Perform a query and return the result as a lazy list. Be sure to +understand the comments about using the lazy list given for 'allDocs'. -} +quickFind :: Connection -> Collection -> Selector -> IO [BSONObject] +quickFind c col sel = find c col sel >>= allDocs + +{- | Perform a query and return the result as a strict list. -} +quickFind' :: Connection -> Collection -> Selector -> IO [BSONObject] +quickFind' c col sel = find c col sel >>= allDocs' + query :: Connection -> Collection -> [QueryOpt] -> NumToSkip -> NumToReturn -> Selector -> Maybe FieldSelector -> IO Cursor query c col opts skip ret sel fsel = do