From d963d89c0b33d5ef2e33c25e1bb2580858b5f97d Mon Sep 17 00:00:00 2001 From: Victor Denisov Date: Sat, 6 May 2017 23:55:27 -0700 Subject: [PATCH] Fix documentation for access function --- CHANGELOG.md | 5 +++++ Database/MongoDB/Query.hs | 3 ++- doc/tutorial.md | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bfdb2f0..3ec5386 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ All notable changes to this project will be documented in this file. This project adheres to [Package Versioning Policy](https://wiki.haskell.org/Package_versioning_policy). +## [2.3.0] - unreleased + +### Changed +- Description of access function + ## [2.2.0] - 2017-04-08 ### Added diff --git a/Database/MongoDB/Query.hs b/Database/MongoDB/Query.hs index 1f580dc..4dec503 100644 --- a/Database/MongoDB/Query.hs +++ b/Database/MongoDB/Query.hs @@ -116,7 +116,8 @@ type Action = ReaderT MongoContext -- ^ A monad on top of m (which must be a MonadIO) that may access the database and may fail with a DB 'Failure' access :: (MonadIO m) => Pipe -> AccessMode -> Database -> Action m a -> m a --- ^ Run action against database on server at other end of pipe. Use access mode for any reads and writes. Return Left on connection failure or read/write failure. +-- ^ Run action against database on server at other end of pipe. Use access mode for any reads and writes. +-- Throw 'Failure' in case of any error. access mongoPipe mongoAccessMode mongoDatabase action = runReaderT action MongoContext{..} -- | A connection failure, or a read or write exception like cursor expired or inserting a duplicate key. diff --git a/doc/tutorial.md b/doc/tutorial.md index 049aa51..ca1c19d 100644 --- a/doc/tutorial.md +++ b/doc/tutorial.md @@ -35,7 +35,7 @@ A DB read or write operation is called a DB `Action`. A DB Action is a monad so > access pipe master "test" allCollections -`access` return either Left `Failure` or Right result. Failure means there was a connection failure, or a read/write failure like cursor expired or duplicate key insert. +`access` throw `Failure` if there is any issue. Failure means there was a connection failure, or a read/write failure like cursor expired or duplicate key insert. `master` is an `AccessMode`. Access mode indicates how reads and writes will be performed. Its three modes are: `ReadStaleOk`, `UnconfirmedWrites`, and `ConfirmWrites GetLastErrorParams`. `master` is just short hand for `ConfirmWrites []`. The first mode may be used against a slave or a master server, the last two must be used against a master server.