This post originated from an RSS feed registered with Java Buzz
by dion.
Original Post: JavaScript in all of the tiers
Feed Title: techno.blog(Dion)
Feed URL: http://feeds.feedburner.com/dion
Feed Description: blogging about life the universe and everything tech
CouchDb is the Next Hot Thing in databases, created by Damien Katz of Lotus Notes infamy, and now MySQL hacker.
CouchDb is a distributed document database system with bi-directional replication. It makes it simple to build collaborative applications that can be replicated offline by users, with full interactivity (query, add, update, delete), and later "synced up" with everyone else's changes when back online.
There have been some exciting updates which now mean that JSON is the data representation of choice, and for views, you can simply use JavaScript functions:
CouchDb now internally uses the JSON representation to handle documents. We got rid of a whole lot of XML-related boilerplate code in the process and less code is always good. JSON then allowed us to get rid of Fabric too, the advantage being that people interested in CouchDb didn't have to learn yet another language. Javascript is pretty well known by now and easy to pick up, too. At last, we even added another buzzword to the ever growing list of CouchDb's features. Views are now created using a map-reduce architecture. An architecture that has already been proven to be massively scalable.
The views are simple functions that you write, that gets handed a document that you can work on. Below we test that the doc is a Person, and return the name. So, it is kinda like select name from people:
This means that if you were so inclined, you could do JavaScript/JSON throughout your architecture. From building the Ajax client, to running JavaScript on the server, to pushing right back to the datastore.