How can I access mongodb from purescript?
the only package I found was purescript-node-mongodb but it looks outdated, and it doesn't install with spago
is there any other recommendation?
if not, should I use nodejs driver?
Found this fork that solves the problem:
https://github.com/j-nava/purescript-mongo
it was as easy as:
queryEmail :: String -> Query User
queryEmail email = Q.by { email: Q.eq email }
findUserEmail email db = do
col <- Mongo.collection "users" db
users <- Mongo.find (queryEmail email) defaultFindOptions col
pure case users of
[] -> Nothing
arr -> arr # Array.head