Commit graph

227 commits

Author SHA1 Message Date
Victor Denisov
655f4b90bc Rename readExactly to read 2016-05-01 19:05:51 -07:00
Victor Denisov
73dfdb0b7f Remove IOStream from Internal.Protocol 2016-05-01 18:17:22 -07:00
Victor Denisov
c011b1a23c Move content of System.IO.Pipeline to Internal.Protocol 2016-05-01 17:34:06 -07:00
Victor Denisov
f956cb2623 Incorporate Tls implementation 2016-05-01 16:15:08 -07:00
Victor Denisov
19e631c9f4 Implement readExactly using hGet 2016-04-30 14:08:19 -07:00
Victor Denisov
494bdcbe56 Add tls implementation 2016-04-30 14:08:19 -07:00
Yuras Shumovich
0b4e3d96ed Support mongolab SCRAM auth
For some reason mongolab requires additional message exchange round.
2015-11-30 15:55:20 +03:00
Victor Denisov
8af6a82ec8 Clean trailing whitespaces 2015-11-07 10:37:40 -08:00
Ralph Morton
6f5f76afbb Add support for SCRAM-SHA-1 authentication 2015-11-01 18:05:39 +02:00
Victor Denisov
75470af421 Retrieve another batch for next in case of unlimited request 2015-09-29 22:42:22 -07:00
Victor Denisov
68ed7beb56 Remove unused writeLazy 2015-08-31 18:04:00 -07:00
Victor Denisov
e45d9329e9 Address performance issues with insert
Compile notices and request into one strict string for performance
boost.
2015-08-29 22:37:05 -07:00
Greg Weber
f385dade31 Merge pull request #25 from VictorDenisov/master
Handle the case when mongodb returns less documents than cursor reque…
2015-07-31 17:59:04 -07:00
Victor Denisov
dca5ae051a Apply reviewer's comments 2015-07-31 03:25:01 -07:00
Victor Denisov
5e72c8ad61 Handle the case when mongodb returns less documents than cursor requested
If we request certain amount of values from a cursor the mongo db server can
return less than requested. So, if we provide -100000 then mongodb may
return 97899 and close the cursor.

Instead of relying on negative values this implementation will use only
positive numbers and will close the cursor itself as soon as the driver
receives enough results.

It fixes the issue #24 from github.
2015-06-19 18:23:44 -07:00
Ralph Morton
9087719087 Support for TTL 2015-06-19 18:26:38 +02:00
Greg Weber
15b14c0acb Merge pull request #21 from mschristiansen/patch-2
Remove Control.Applicative imports and tab character
2015-05-16 11:40:11 -05:00
Mikkel Christiansen
f69440d7fa Remove applicative import warnings in GHC 7.10.1. 2015-05-15 15:26:34 +02:00
Mikkel Christiansen
6d877b4da2 Change all instances of myPipe, etc. to mongoPipe, etc. 2015-05-15 09:58:25 +02:00
Mikkel Christiansen
78c0619e02 Export MongoContext constructor
I have a reader monad with app configuration that I would like to make an instance of HasMongoContext and then need the MongoContext constructor to add a MongoContext to my own reader monad.
2015-05-14 14:53:08 +02:00
Greg Weber
98bcc2dfe8 abstract connection interface
rebase #13 to master
2015-03-05 11:21:58 -08:00
Greg Weber
a047c309e5 better findAndModify error handling 2014-07-24 08:12:44 -07:00
Greg Weber
f2a6307530 repsert -> upsert 2014-07-24 08:12:15 -07:00
Greg Weber
d2d4f9534c export defFamUpdateOpts 2014-07-19 19:32:33 -07:00
Greg Weber
9259d392d3 add findAndModifyOpts
supports the full range of optiosn for findAndModify
2014-07-08 12:44:41 -07:00
Fedor Gogolev
5ca3b1c210 Fix merge conflict 2014-04-12 17:17:47 +04:00
Fedor Gogolev
adb57dce72 Merge branch 'pr-20'
Conflicts:
	Database/MongoDB/Query.hs
2014-04-12 17:06:52 +04:00
Sean Leather
61c333eee1 Link 'find' and 'delete' in 'select' documentation 2014-03-09 17:21:30 +02:00
Michael Snoyman
a43c94f977 Remove MonadIO' 2013-12-27 13:39:22 +02:00
Michael Snoyman
3a97c2cbdb Turn Action into a type synonym, not a newtype 2013-12-26 17:32:21 +02:00
Michael Snoyman
ab5fcb1f78 HasMongoContext instead of liftDB 2013-12-26 17:28:44 +02:00
Michael Snoyman
bd3d90f740 Rename Context to MongoContext 2013-12-26 17:24:15 +02:00
Michael Snoyman
caab81a54e Get rid of usage of ErrorT 2013-12-26 17:23:02 +02:00
Michael Snoyman
756c9181cb Replace hard tabs with spaces 2013-12-26 16:57:33 +02:00
Edward Z. Yang
4ce8a44011 Fix some warnings.
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
2013-11-06 23:15:50 -08:00
Edward Z. Yang
5656f90c27 Convert to use hashtables, as Data.HashTable went away.
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
2013-11-06 23:04:16 -08:00
Greg Weber
57722a7d43 handle findAndModify edge cases
also give better error messages
2013-08-29 11:57:07 -07:00
Greg Weber
45a0e8e9e2 add findAndModify command 2013-06-06 08:00:00 -07:00
Timo von Holtz
83cae75efc Added Support for Aggregate Framework 2013-05-24 00:15:56 +02:00
Fedor Gogolev
46b3f1f3fa Support for network 2.4.1 2013-01-21 02:08:20 +04:00
Amit Aryeh Levy
5ce857a4db Make sure 7.6 modifications stil compile with 7.4 2012-10-23 16:49:29 -04:00
Amit Aryeh Levy
ed0c264a35 GHC 7.6 Support
lifted-base no longer contains addMVarFinalizer
2012-10-19 02:29:10 -07:00
Michael Snoyman
681f9f875f GHC 7.6 support 2012-09-10 20:25:45 +03:00
Fedor Gogolev
4ae4f793e3 Function eval returns Val v instead of Document
Fixes #1
2012-07-09 08:26:58 +04:00
Fedor Gogolev
dd6a3010f6 Cleaned up imports 2012-06-10 23:47:14 +04:00
Fedor Gogolev
17f528e835 Use text instead of compact-string-fix 2012-05-08 19:13:25 +04:00
Greg Weber
b706780844 use -fno-warn-orphans 2012-02-29 11:35:55 -08:00
Andrew Miller
d3f54922cc Add routedHost as an alternative to primary / secondaryOk that lets the user supply their own sort function. This is useful for applications like preferentially connecting to the host or secondary that is geographically the closest. 2012-02-12 17:34:07 +13:00
Tony Hannan
5e015dc769 Merge pull request #14 from yesodweb/show-AccessMode
show instance for AccessMode
2012-01-28 15:50:53 -08:00
Greg Weber
6ef19663cf show instance for AccessMode 2012-01-27 12:48:54 -03:00
Tony Hannan
2f23e78c28 Use MVar from lifted-base 2012-01-23 20:45:10 -05:00
Tony Hannan
d0aeb42e7c merge duplicate code 2012-01-23 19:45:42 -05:00
Michael S. Craig
fa95b65fad Fix for bad behavior when using TailableCursor.
`Database.MongoDB.Query.next` and `nextBatch` prefetch a promise of the next
batch of documents from the server whenever the current batch has been
exhausted. The following call to `next` or `nextBatch` fulfills that promise
(thereby turning it into a concrete batch of documents) and then returns one or
more documents in the batch.

The old behavior was to raise an exception if an empty batch with a nonzero
cursor ID was encountered. This is normal when using tailable cursors, so a
change was required.

Now, `Nothing` is returned with the still-live cursor ID, instead of raising
the exception. Also, prefetched empty batches with nonzero cursor IDs are
refetched once per call to avoid stale data.

This new prefetching behavior does not affect the performance of `next`, except
when calling it repeatedly on a tailable cursor with no new data. In those
(generally avoidable) cases, each call to `next` results in two server calls
instead of one.
2011-12-13 11:02:57 -05:00
Nathan Howell
b18f81f431 Updating to monad-control-0.3, with help from Bas van Dijk.
Conflicts:

	Database/MongoDB/Query.hs
2011-12-05 09:23:39 -08:00
Tony Hannan
d506011cd1 fix some warnings. bump version for previous 7.2.1 compatibility fix 2011-11-10 10:23:07 -05:00
Ryan Trinkle
ccd217053b fix missing record field in P.Request value
the fields of a Database.MongoDB.Internal.Protocol.Query were not filled in by RecordWildcard on line 411 of Database/MongoDB/Query.hs because the record fields were not in scope
2011-10-27 15:24:37 -04:00
Tony Hannan
efb6b65506 QueryFailure error code 2011-09-07 12:09:20 -04:00
Michael Snoyman
a320c363e4 Move to monad-control 2011-08-25 16:29:39 +03:00
Tony Hannan
4307fea5aa collect ids from insert lazily in case not used 2011-08-18 19:41:32 -04:00
Tony Hannan
c99cb54251 Partial results option 2011-07-22 10:38:50 -04:00
Tony Hannan
17ceb53234 tailable cursor 2011-07-22 10:31:24 -04:00
Tony Hannan
58f83838de Cursor nextBatch 2011-07-21 18:50:52 -04:00
Tony Hannan
5e4a8aee3f insertAll (KeepGoing) 2011-07-21 16:39:19 -04:00
Tony Hannan
19da43a348 connect timeout 2011-07-21 11:27:19 -04:00
Tony Hannan
acb0d62aa2 Intro to Haskell article (first draft) 2011-07-14 18:47:14 -04:00
Tony Hannan
8025ac4ec4 Small edits to some comments. fix secondaryOk to return master only when no secondaries available 2011-07-13 15:34:52 -04:00
Tony Hannan
8672652395 move Pool to System.IO. update docs 2011-07-12 10:51:54 -04:00
Tony Hannan
23fdaee494 renamed docs/ to doc/ 2011-07-08 22:33:52 -04:00
Tony Hannan
91c88c0a14 combined read & write mode into a single access mode. newtyped Action monad. liftDB for monads stacked on top of Action. fetch op 2011-07-08 22:13:47 -04:00
Tony Hannan
9f48c26384 Simplify! Removed Context and Throw monad classes. Removed embedded pool from replica-set. Not backwards-compatible, starts new major version 1.x 2011-07-05 10:37:01 -04:00
Tony Hannan
f7ae5b7235 MapReduce updated to work with MongoDB version >= 1.7.4 2011-06-22 17:18:32 -04:00
Tony Hannan
3db3cc9999 fix minor compiler warnings 2011-03-14 16:28:09 -04:00
Tony Hannan
624890c1a6 fix replica set connection bug 2011-03-14 16:24:28 -04:00
Tony Hannan
db58a9c4ca use md5 from cryptohash package instead of nano-md5 to remove dependency on OpenSSL 2011-03-11 11:11:14 -05:00
Tony Hannan
a1b47687e8 Some additional error checking in connection command reply 2011-03-10 19:37:48 -05:00
Tony Hannan
c6dd2883d2 Fix typo in conditional compilation 2011-02-22 10:48:14 -05:00
Tony Hannan
a32f0c3234 Make Database.MongoDB.Connection compatible on Windows by not using PortID's UnixSocket constructor unless compiling on Unix 2011-02-22 10:31:54 -05:00
Tony Hannan
a399e81925 Access monad no longer needs to be a MonadMVar 2011-01-26 14:25:12 -05:00
Tony Hannan
73012bb430 Single param Network instance. NetworkIO instance of IO that yields Internet so user does not have to supply it 2010-12-27 00:23:02 -05:00
Tony Hannan
111d9a2f72 Abstract network communication so we can capture and replay messages if desired. Also, remove dependence on deprecated ImpredicativeTypes. 2010-12-19 21:08:53 -05:00
Tony Hannan
8da53a3fa3 Use Monad.MVar. Remove Delayed wrapper around promise. 2010-11-01 15:35:13 -04:00
Tony Hannan
36cc86fd70 Rename Connection to ConnPool. Edit tutorial and some comments 2010-10-31 20:38:38 -04:00
Tony Hannan
583f8330c7 Fix compile warnings 2010-10-27 16:46:11 -04:00
Tony Hannan
de32b22b4f Connection pooling and some refactoring 2010-10-27 16:13:23 -04:00
Tony Hannan
2568f9e530 remove a couple shadow warnings 2010-07-27 17:30:52 -04:00
Tony Hannan
3a7f235246 Slight API refactoring. Fix spinning pipeline when other end disconnects. Handle response flags correctly 2010-07-27 17:18:53 -04:00
Tony Hannan
6435bc3cd9 Handle response flags correctly, plus some comment changes 2010-07-03 13:15:30 -04:00
Tony Hannan
c9dc87ad33 Slight redesign: pipelining with writeMode instead of exclusive access with getLastError 2010-06-21 11:06:20 -04:00
Tony Hannan
d0ddc814a9 Change comments to reflect new knowledge that a cursor persists across connections, and map/reduce temp output is accessible from all connections as long as original remains alive 2010-06-15 16:15:37 -04:00
Tony Hannan
3e4065cd97 See V0.5.0-Redesign.md for description of changes in this commit 2010-06-14 23:14:40 -04:00
Scott R. Parish
e329747c1a fix type nit for putStrSz 2010-04-15 20:55:00 -05:00
Scott R. Parish
78823834f4 BsonSymbol had a similar utf8 length problem 2010-04-15 20:54:44 -05:00
qxjit (David Vollbracht)
cb223110e6 Fix string size in bson docs to be number of bytes rather than number of utf8 chars 2010-04-15 11:49:25 +08:00
Scott R. Parish
e76012d227 BSON.hs: docs for functions missing such 2010-03-15 07:17:57 -05:00
Scott R. Parish
8df947c704 8e035fded4 missed the Put side 2010-03-14 13:25:44 -05:00
Scott R. Parish
3956adab00 create global oigInc instance
Before if multiple threads instantiated their own ObjectIdGen
structure it would be possible to get duplicate objectid's
generated. By making sure there is a single inc counter, this is
avoided.
2010-03-13 21:44:42 -06:00
Scott R. Parish
e7c58bf4d7 BSON: use Integers to represent oid's, oid generation 2010-03-13 00:23:05 -06:00
Scott R. Parish
108532268b putI16 2010-03-12 23:03:56 -06:00
Scott R. Parish
ab3b73b9ac util: type putI8 like the other putI* functions 2010-03-12 23:03:37 -06:00
Scott R. Parish
8e035fded4 DataBinary's subtype ByteArray alone has an extra length
ByteArray has the extra length, aparently as a historical artifact,
requiring it to be special cased.

Thanks to Mathias Stearn for pointing this out!
2010-03-10 20:34:58 -06:00
Scott R. Parish
34599280f5 converter for Maybe type 2010-03-09 18:58:42 -06:00
Scott R. Parish
c1b8a21366 restoring array conversion using toBson/fromBson 2010-03-09 18:36:14 -06:00
Scott R. Parish
fb2f09171a change BsonDoc representation to maintain order
Turns out that order is sometimes important for BSON documents. Case
in point, "mapreduce" has to be the first field for the map/reduce
command.

To accomidate this we'll switch from using 'Map' to using a tuple-list
(eg '[(L8.ByteString, BsonValue)]'). Luckily most code that was using
toBsonDoc doesn't need to change.

While at it, 'Convertible' is not adding much value, and was causing
ambiguities making it less usefull (was requiring explicit type hints
more then it should have). Thus we are switching to our own conversion
typeclasses.
2010-03-08 07:08:30 -06:00
Scott R. Parish
7587f435a2 support javascript code, rename to BsonJSCode to make it clearer what code 2010-03-08 07:04:04 -06:00
Scott R. Parish
cf9975468f rename BsonObject to BsonDoc to be more consistant with BSON definition 2010-03-06 12:28:57 -06:00
Scott R. Parish
92f37cc946 make changes suggested by hlint 2010-02-06 15:52:23 -06:00
Rick Richardson
58fbd2005f added whereClause, tidied code 2010-02-05 08:31:01 -05:00
Scott R. Parish
d606e47f33 make changes suggested by HLint 2010-01-24 20:58:49 -06:00
Scott R. Parish
f8652ed11a make BsonDoc a 'type' rather then 'newtype'
All the wraping/unwraping for the newtype was really cumbersome and
protection isn't really needed here.
2010-01-20 22:31:32 -06:00
Scott R. Parish
66ad002718 BsonValue convertible instances so fromBson can unwrap BsonObjects 2010-01-20 20:55:33 -06:00
Scott R. Parish
f173d9d0a7 convertible for BsonObject 2010-01-19 20:30:04 -06:00
Scott R. Parish
2c6905b45f BSON.empty 2010-01-18 18:32:44 -06:00
Scott R. Parish
30925bc90f add BsonDocOps class so document can be specified with String keys 2010-01-18 18:05:09 -06:00
Scott R. Parish
cef52ebf12 BSON.lookup 2010-01-18 15:04:14 -06:00
Scott R. Parish
f5f0ec2b8e add documentation for public functions/types 2010-01-18 13:24:14 -06:00
Scott R. Parish
949bece818 class for toBson/fromBson, instances for Maybe
For example, you can now use fromBson of Maybe BsonValue (eg the result of
a lookup) to convert to Maybe a.

You can also give a Maybe a to toBson and for Nothing it will produce
BsonNull and for Just a it will create the appropriate BsonValue for a.
2010-01-18 10:26:13 -06:00
Scott R. Parish
f60d984677 some initial Convertibles for converting from Bson 2010-01-18 09:57:25 -06:00
Scott R. Parish
67bf1245bb some initial (to BsonValue) Convertible instances and toBson 2010-01-17 23:08:14 -06:00
Scott R. Parish
4cfd4e7fa3 use what appears to be more standard naming, eg BsonValue instead of BSValue 2010-01-17 11:41:24 -06:00
Scott R. Parish
7f777c8fb4 compile with -Wall and -Werror, fix all ensuing breaks 2010-01-16 21:40:22 -06:00
Scott R. Parish
4c17f8e646 licenses (MIT) 2010-01-16 19:22:46 -06:00
Scott R. Parish
d1cccd075d create and use putNothing instead of using flush as a no-op 2010-01-12 19:59:52 -06:00
Scott R. Parish
b18d3d54b0 BSON: fix unexported data constructor 2010-01-10 21:23:54 -06:00
Scott R. Parish
2cea5777fb BSON: use Data.Map for BSONObjects 2010-01-10 21:23:54 -06:00
Scott R. Parish
61051bfc46 move the get/put* helpers to Util.hs so other modules can use them 2010-01-10 21:23:50 -06:00
Scott R. Parish
06391f5992 stuff to make into a package 2010-01-09 16:49:06 -06:00
Scott R. Parish
5c5ec38413 move BSON.hs to Database/MongoDB/BSON.hs 2010-01-09 16:36:59 -06:00