Vote count:
0
I write a program connect to mongoDB and query data from it. But I have a problem that I couldn't solve when try to use higher order function. Example, I want to get the host of worldcup 2014 by a function and follow that, I use this result to get the goal of this host in worldcup 2014. The problem is the result of query command in mongoDB library return to Action IO [Document], but i expect to return [Document] or [String] or [Int]. The code below I get the host of worldcup 2014
getHostOfYear year = do
let documents = rest =<< find (select ["_year" =: year] infoWorldcup)
docs <- documents
mapM_ temp docs
temp :: Document -> Action IO ()
temp doc = do
liftIO $ printf "%s " $ getString "_host" doc
Please show me some solution to solve this problem? Thank you!
asked 10 secs ago
Haskell query mongoDB with Higher Order Function
Aucun commentaire:
Enregistrer un commentaire