Commit graph

199 commits

Author SHA1 Message Date
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
442ed03027 module level documentation to point to tutorials 2010-03-13 22:09:47 -06:00
Scott R. Parish
56fcb3a90e insert/insertMany/save: create (if needed) and return '_id' field 2010-03-13 21:46:46 -06: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
6045cc5c4b format nits 2010-03-12 23:54:41 -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
cbc5128d47 mongodb returns count as a double: fix count function 2010-03-09 18:36:15 -06:00
Scott R. Parish
c1b8a21366 restoring array conversion using toBson/fromBson 2010-03-09 18:36:14 -06:00
Scott R. Parish
ece60d87ad better mapReduce apis
+ mapReduce is now the convience function that returns a cursor
+ runMapReduce can be called if you want the intermediate
  result meta-data
+ mapReduceResults will take the result meta-data and open a
  cursor on it
2010-03-08 19:43:34 -06:00
Scott R. Parish
0a391e631b mapreduce command 2010-03-08 07:08:34 -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
08b601f124 adding ConnectOpts and an initial SlaveOk option 2010-02-26 19:39:28 -06:00
Scott R. Parish
2cee44d6a3 fix whitespace nits 2010-02-24 07:10:35 -06:00
Scott R. Parish
a3c56b3c2e simplify findOne 2010-02-24 07:10:35 -06:00
Scott R. Parish
f1fdc0f13b automatically find and connect to master 2010-02-24 07:10:32 -06:00
Scott R. Parish
b3581b5209 logout 2010-02-06 16:10:52 -06:00
Scott R. Parish
53fe82d117 create auth alias to be consistent with mongo JS api 2010-02-06 15:57:15 -06:00
Scott R. Parish
92f37cc946 make changes suggested by hlint 2010-02-06 15:52:23 -06:00
Scott R. Parish
613fc8ff6d allow individual ports to be set for connecting to cluster 2010-02-06 15:35:37 -06:00
Scott R. Parish
847e8bac8b create type aliases for Username and Password
This will make the resulting documentation more clear what to pass
to the login and addUser functions
2010-02-06 14:56:56 -06:00
Scott R. Parish
8f972f6dda fix some haddock problems
Unfortunately it seem (emperically) that haddock only allows the pipe
character on the first line of document, not on every line. Or more
literally, it allows them, but treats them as part of the output to
display in the rendered document.

Fixing that, it also wasn't happy about not introducing the code block
as a new paragraph.
2010-02-06 14:52:09 -06:00
Scott R. Parish
34b4d22856 fix whitespace (mostly trailing) introduced in merge 2010-02-06 14:49:39 -06:00
Scott R. Parish
2f452e989c Merge remote branch 'rrichardson/master' 2010-02-06 14:40:23 -06:00
Scott R. Parish
35856c20a3 make suggestions given by hlint 2010-02-06 10:38:53 -06:00
Rick Richardson
58fbd2005f added whereClause, tidied code 2010-02-05 08:31:01 -05:00
Rick Richardson
e606b1bc1f tweaks and such 2010-02-02 22:40:41 -05:00
Rick Richardson
0cf0da8ab6 added login/user mgmt, added multiple handles in the connection 2010-02-02 16:06:53 -05:00
Scott R. Parish
9bc616ccf5 finish: only close cursor if cursor-id is non-zero
A '0' cursor-id means that no cursor was created, so there's nothing
to kill.

Also, findOne should never have a cursor opened for it, so no need
to even call finish.
2010-02-01 09:04:47 -06:00
Brian Gianforcaro
4c369f7a92 Fix small white space error
Signed-off-by: Scott R. Parish <sparish@peak6.com>
2010-01-26 06:26:26 -06:00
Brian Gianforcaro
78a526d9d7 Add and expose serverShutdown.
Signed-off-by: Scott R. Parish <sparish@peak6.com>
2010-01-26 06:26:21 -06:00
Brian Gianforcaro
73d147f875 A few comment spelling corrections
Signed-off-by: Scott R. Parish <sparish@peak6.com>
2010-01-26 06:24:23 -06:00
Scott R. Parish
d606e47f33 make changes suggested by HLint 2010-01-24 20:58:49 -06:00
Scott R. Parish
5ae3c4c2ae databasesInfo, databaseNames 2010-01-22 06:23:39 -06:00
Scott R. Parish
6bf32ab9eb serverInfo 2010-01-21 21:09:20 -06:00
Scott R. Parish
e8f6141529 renameCollection 2010-01-21 19:12:06 -06:00
Scott R. Parish
62dfc44393 indexInformation 2010-01-21 18:55:23 -06:00
Scott R. Parish
bb9bbf56d2 switch apis to all use Lazy.ByteString 2010-01-20 23:19:39 -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
b413958ef7 dropIndexes 2010-01-20 06:20:30 -06:00
Scott R. Parish
7df946f697 dropIndex 2010-01-19 22:44:14 -06:00
Scott R. Parish
f1aa28b9e4 docs for createIndex 2010-01-19 22:35:21 -06:00
Scott R. Parish
46839acdbc createIndex 2010-01-19 22:31:38 -06:00
Scott R. Parish
f173d9d0a7 convertible for BsonObject 2010-01-19 20:30:04 -06:00
Scott R. Parish
bff4817970 expose runCommand 2010-01-19 06:31:59 -06:00
Scott R. Parish
45b9be608e rename Collection to FullCollection to be consistant with server docs 2010-01-19 06:28:17 -06:00
Scott R. Parish
ba53b4b7e8 forgot docs for validateCollection and dropCollection 2010-01-18 22:20:01 -06:00
Scott R. Parish
dc99780c03 count, countMatching 2010-01-18 22:19:38 -06:00
Scott R. Parish
d7f6cfc348 validateCollection 2010-01-18 21:39:38 -06:00
Scott R. Parish
6569157051 dropDatabase 2010-01-18 21:31:21 -06:00
Scott R. Parish
311e0462ac dropCollection 2010-01-18 21:26:34 -06:00
Scott R. Parish
73d9a00d5f createCollection 2010-01-18 21:26:00 -06:00
Scott R. Parish
3aaee6cf84 findOne: tell database to only return one 2010-01-18 19:36:10 -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
121dcbfd93 findOne 2010-01-18 17:31:41 -06:00
Scott R. Parish
378bc42393 collectionNames 2010-01-18 15:04:38 -06:00
Scott R. Parish
cef52ebf12 BSON.lookup 2010-01-18 15:04:14 -06:00
Scott R. Parish
ee8cd25138 disconnect 2010-01-18 15:04:05 -06:00
Scott R. Parish
f5f0ec2b8e add documentation for public functions/types 2010-01-18 13:24:14 -06:00
Scott R. Parish
9f57eca933 make field selector a list rather then a BsonDoc
Requiring callers to construct {foo: 1, bar: 1} style field selectors
is just dumb. Instead we'll let them pass in the field selector as a list
of strings and then construct the above form automatically for them.
2010-01-18 12:43:05 -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
a5ab7cdb64 quickFind and quickFind' 2010-01-16 20:06:01 -06:00
Scott R. Parish
183e619362 allDocs': a strict version of allDocs 2010-01-16 19:38:11 -06:00
Scott R. Parish
4c17f8e646 licenses (MIT) 2010-01-16 19:22:46 -06:00
Scott R. Parish
0c019ad0e9 allDocs: create a lazy list off a cursor 2010-01-16 19:14:47 -06:00
Scott R. Parish
344c6bb975 add find command: simpler to use then query for most uses 2010-01-16 18:54:26 -06:00
Scott R. Parish
20f68b706c rename curClose to finish a-la HDBC 2010-01-16 18:33:32 -06:00
Scott R. Parish
78427d37b1 conClose and curClose 2010-01-16 18:04:15 -06:00
Scott R. Parish
f5a946c0e0 query now returns a cursor, nextDoc iterates over the cursor 2010-01-16 18:03:17 -06:00
Scott R. Parish
8805ea4a9e add missing exports 2010-01-16 17:59:15 -06:00
Scott R. Parish
ee1e4d3528 add protocol asserts 2010-01-16 17:59:10 -06:00
Scott R. Parish
6a9a533fcc adding update support 2010-01-14 07:16:20 -06:00
Scott R. Parish
985423cfe7 fixes for query opts 2010-01-14 07:04:24 -06:00
Scott R. Parish
a2c5888e41 expose query options 2010-01-13 07:14:31 -06:00
Scott R. Parish
df29bf73b3 simple querying works and will return docs 2010-01-12 20:08:28 -06:00
Scott R. Parish
2ccab779f9 Binary.Put didn't treat Maybe the way i thought
I thought maybe it would unwrap Just x and put x, or not put anything
if Nothing, but aparently it puts \NUL if Nothing
2010-01-12 20:07:34 -06:00
Scott R. Parish
dd3e982c9e s/reqId/reqID to match spec 2010-01-12 20:05:24 -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
41b9c8d139 initial MongoDB.hs: can insert and delete 2010-01-10 21:23:54 -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