CouchDB is a non-relational, no-sql database which is build relying on the HTTP stack. It’s from the apache foundation.
The Wiki of CouchDB provides this info about the windows version.
Installation of CouchDb on Windows
The current release (at the moment of writing) is 1.1.1 and it’s up on Github.
Their wiki gave me this download file:
![CouchDB for windows download CouchDB for windows download]()
As Dave pointed out in the comments, you should download 1.2 now from https://couchdb.apache.org/#download. Thanks Dave!
You can open it and keep all the default settings.
After the installation completes, you can visit http://127.0.0.1:5984
You would see this:
![CouchDB on windows installation succes CouchDB on windows installation succes]()
The management tool, Futon, can be reached in subdirectory _utils.
So just click on this link to see the CouchDB’s version of “PhpMyAdmin”
http://127.0.0.1:5984/_utils/
![CouchDB Futon CouchDB Futon]()
So you are good to go!
More details about CouchDB on Windows can be found on the Quirks page.
But that’s optional.
Setup CouchDb
With the default installation, you will see this message:
![image image]()
It is recommended to create one Admin user. You can create a database afterwards by clicking on the top left link.
![image image]()
You can set the security of the CouchDb if you have added some more users, but we will skip that for the moment and start using the database from our Asp.Net WebForm web application.
Asp.Net and CouchDb
There are a lot of options to access CouchDb. You can do everything manually, since it is just a combination of JSON and REST. But there are also a lot of wrappers available which support streaming and/or POCO etc.
Lots of benefits which differ from wrapper to wrapper. The official documentation of CouchDb recommends the following:
When you look for Nuget packages with the keyword CouchDb you will only find LoveSeat and DreamSeat at the moment. Both are using Json.Net a.k.a. Newtonsoft.Json. NuGet will pull that reference in, so don’t worry. I just mentioned it, so that you know that you can use that library to parse objects to JSON.
If you look for resources for CouchDB, you will see a lot Unix oriented. A lot requires CURL. You can get it for windows, or (recommended) get Git for windows and get curl for free http://superuser.com/a/483964/24642
You can read more about that on the run curl commands with windows thread on superuser.
This is my DreamSeat code. The blog object is a test object with comments etc. just to fill the database with a JSON serializable object with related objects.
private void TestDreamSeat()
{
var blog = GetBlog();
var client = new DreamSeat.CouchClient();
var db = client.GetDatabase("southwind");
DreamBlog dream =(DreamBlog)blog;
dream = db.CreateDocument<DreamBlog>(dream, new Result<DreamBlog>()).Wait();
DreamBlog myObj = db.GetDocument<DreamBlog>(dream.Id);
Response.Write(myObj.Name);
db.DeleteDocument(myObj);
}
And this is my LoveSeat test
private void TestLoveSeat()
{
var blog = GetBlog();
var client = new LoveSeat.CouchClient();
var db = client.GetDatabase("southwind");
string blogAsJson = JsonConvert.SerializeObject(blog);
var doc = new Document(blogAsJson);
doc.Id = new Guid().ToString();
doc = (Document) db.CreateDocument(doc);
Blog myObj = db.GetDocument<Blog>(doc.Id);
Response.Write(myObj.Name);
db.DeleteDocument(doc.Id, doc.Rev);
}
I used the
System.Diagnostics.Stopwatch
class to measure the differences and I was planning to test all the libraries that I have found and mentioned earlier. But I believe that the best solution is to stick with the libraries that are in the NuGet repository, because other libraries might be outdated.
Get the sample code from:
https://github.com/jphellemons/CouchDbFromDotNet
Good luck coding!
![kick it on DotNetKicks.com]()
![Shout it]()