简体   繁体   中英

How can I access mongodb from purescript?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM