Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
98 lines (75 sloc) 4.67 KB

Divan, a C# library for CouchDB

Divan is a C# library under the MIT license for using CouchDB (www.couchdb.org). It should be more or less API complete including bulk operations, attachments, views and design documents etc. It is quite fast and designed to be flexible but not bloated.

Divan has been developed in-house at Foretagsplatsen AB (www.foretagsplatsen.se) and is being used in the new core system at Foretagsplatsen. It has unit tests (although could benefit from more) and at least one sample console project included.

License

Divan is under the MIT-license, see file LICENSE.txt.

Does it work under Mono?

You bet. Foretagsplatsen uses mainly windows (Visual Studio 2008 and .Net 3.5) but Divan is meant to work fine in Mono too.

What about documentation?

At the moment documentation is… this file! :) But there are unit tests in CouchTest.cs and there is at least one sample project showing basic usage. One more sample with more advanced usage is coming soon.

Dependencies

The only dependencies and their tested versions are:

The two neeed dlls are included in the lib directory.

Getting started

Well… it goes something like this:

  1. First get CouchDB up and running on some box.

  2. Clone Divan and build it.

  3. Run the “Trivial” sample console app by pointing it at a running CouchDB server getting output similar to this:

C:DivansamplesTrivial>binDebugTrivial.exe 192.168.9.205 5984 Using 192.168.9.205:5984 Created a CouchServer Request: 192.168.9.205:5984/trivial Method: HEAD Request: 192.168.9.205:5984/trivial Method: PUT Created database 'trivial' Request: 192.168.9.205:5984/trivial/ Method: POST Request: 192.168.9.205:5984/trivial/ Method: POST Request: 192.168.9.205:5984/trivial/ Method: POST Request: 192.168.9.205:5984/trivial/ Method: POST Request: 192.168.9.205:5984/trivial/ Method: POST Request: 192.168.9.205:5984/trivial/ Method: POST Request: 192.168.9.205:5984/trivial/ Method: POST Request: 192.168.9.205:5984/trivial/ Method: POST Request: 192.168.9.205:5984/trivial/ Method: POST Request: 192.168.9.205:5984/trivial/ Method: POST Saved 10 Cars with 170 hps each. Request: 192.168.9.205:5984/trivial/86a9d1ad306e204a037940c4fb0cbbe7 Method: PUT Modified last Car with id 86a9d1ad306e204a037940c4fb0cbbe7 Request: 192.168.9.205:5984/trivial/86a9d1ad306e204a037940c4fb0cbbe7 Method: GET Loaded last Car Saab 93 now with 400hps. Request: 192.168.9.205:5984/trivial/_all_docs?include_docs=true Method: GET Loaded all Cars: 10 Request: 192.168.9.205:5984/trivial/1f6de464ae8034eb952b93105807f22c?rev1-208231211 Method: DELETE Deleted car with id 1f6de464ae8034eb952b93105807f22c Request: 192.168.9.205:5984/trivial/44f9638877fc09e07bda6504a5bfd40d?rev1-345884075 Method: DELETE Deleted car with id 44f9638877fc09e07bda6504a5bfd40d Request: 192.168.9.205:5984/trivial/591e0ef170154311aafa8a2a5fcbb310?rev1-2891194419 Method: DELETE Deleted car with id 591e0ef170154311aafa8a2a5fcbb310 Request: 192.168.9.205:5984/trivial/7124fada0f90ed93f88168dc6c1c8b4f?rev1-2479256166 Method: DELETE Deleted car with id 7124fada0f90ed93f88168dc6c1c8b4f Request: 192.168.9.205:5984/trivial/73115c4dd3b2bcd512412813dd04b901?rev1-3993011972 Method: DELETE Deleted car with id 73115c4dd3b2bcd512412813dd04b901 Request: 192.168.9.205:5984/trivial/78a305543bff2f474cbcfe2ac667cc6d?rev1-1583012745 Method: DELETE Deleted car with id 78a305543bff2f474cbcfe2ac667cc6d Request: 192.168.9.205:5984/trivial/86a9d1ad306e204a037940c4fb0cbbe7?rev2-1402499148 Method: DELETE Deleted car with id 86a9d1ad306e204a037940c4fb0cbbe7 Request: 192.168.9.205:5984/trivial/9e647b114b9ba1c8a170ed1c1951260c?rev1-30425501 Method: DELETE Deleted car with id 9e647b114b9ba1c8a170ed1c1951260c Request: 192.168.9.205:5984/trivial/bad56664dec8f3d1fd30db70510f7ff2?rev1-1765374009 Method: DELETE Deleted car with id bad56664dec8f3d1fd30db70510f7ff2 Request: 192.168.9.205:5984/trivial/cbf0bb7f8ebc4aad02a2c90228d1076f?rev1-2425501185 Method: DELETE Deleted car with id cbf0bb7f8ebc4aad02a2c90228d1076f Request: 192.168.9.205:5984/trivial Method: HEAD Request: 192.168.9.205:5984/trivial Method: DELETE Deleted database

  1. Look at couchTest.cs and make sure the tests are green, you may need to edit CochServer.cs with different default server ip.

  2. Have fun!

Something went wrong with that request. Please try again.