繁体   English   中英

如何从 purescript 访问 mongodb?

[英]How can I access mongodb from purescript?

如何从 purescript 访问 mongodb?

我发现的唯一 package 是 purescript-node-mongodb 但它看起来已经过时了,而且它没有与 spago 一起安装

还有其他建议吗?

如果没有,我应该使用 nodejs 驱动程序吗?

找到解决问题的叉子:

https://github.com/j-nava/purescript-mongo

这很简单:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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