Skip to content
This repository has been archived by the owner on Jun 10, 2021. It is now read-only.

SimonRichardson/purescript-node-mongodb

Repository files navigation

purescript-node-mongodb

Build Status

An library taking advantage of purescript-aff to enable pain-free asynchronous MongoDB queries.

Getting Started

Installation

bower install purescript-node-mongodb

Introduction

You can construct queries with the mongo functions:

main = unsafePartial $ void $ launchAff $ do
  Right db <- attempt $ connect $ defaultOptions
  col <- collection "events" db
  evt <- findOne [ "name" := "Amazing!" ] [ "name" := 1 ] col

  liftEff $ traceAny (evt :: [Event])

  close db

See the module documentation for a full list of these helpers

See the test cases for more examples

Module documentation

The following is likely to be removed in favor of purescript-uri

General

Note: This is a wrapper around the node library and as such is limited to that very fact. It's possible to write a better interface (with more time) that removes the node library and talks directly to the database.