Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Couch db


Published on

Introduction to CouchDB and installation

Published in: Education
  • Be the first to comment

Couch db

  1. 1. CouchDB Guide: Prof.S.S.Shaikh Presented by: Rashmi Agale Department of Computer Engineering AISSMS COE,Pune-01
  2. 2.  Introduction  RDBMS vs NoSQL  SQL vs NoSQL  Types of NoSQL Database  CouchDB  Document oriented  JSON document  Map/Reduce  HTTP API  Replication  Eventual consistency Overview
  3. 3.  Features of CouchDB  Pros and Cons of CouchDB  Friends of CouchDB  CouchDB vs MongoDB  Screenshots  References Overview
  4. 4. RDBMS vs NoSQL
  5. 5. SQL vs NoSQL
  6. 6. Types of NoSQL Database
  7. 7.  First released in 2005 and later became Apache project in 2008  Relax: Non-technical person can learn it  Fault tolerant and failure occur in controlled environment  Scaling: Growing and shrinking of hardware in your application is allowed  CouchDB is written in Erlang, a functional programming language with a focus on writing robust, fault tolerant and highly concurrent applications  A document oriented NoSQL database  Store data with JSON documents  Uses JavaScript as a query language for Map/Reduce indexes  HTTP for its API  RESTful interface  Eventual consistency  Replication CouchDB
  8. 8. Architecture of CouchDB  It is a 2-tier architecture  CouchDB uses HTTP as its main programming interface and JSON for data storage.  As we have JavaScript on Client side, performance will increase due to compatibility of JSON with JavaScript  CouchDB is compatible to platforms such as Windows, Linux, Mac-iOS, Android mobiles.  CouchDB is more suitable for Client app such as web applications.
  9. 9.  It is a computer program designed for storing, retrieving, and managing document-oriented information, also known as semi-structured data  Unlike a relational database, CouchDB does not store data and relationships in tables. Instead, each database is a collection of independent documents. Each document maintains its own data and self-contained schema. An application may access multiple databases, such as one stored on a user's mobile phone and another on a server.  Document databases get their type information from the data itself, normally store all related information together  It allows every instance of data to be different from any other. This makes them more flexible in dealing with change and optional values, maps more easily into program objects and often reduces database size. This makes them attractive for programming modern web applications, which are subject to continual change in place, and speed of deployment is an important issue Document oriented database
  10. 10. Document oriented database
  11. 11. JSON documents  It is Java script object notation.  It is a open standard format that uses human-readable text to transmit data objects consisting of attribute–value pairs  It is a light weight data format based on JavaScript syntax therefore web application is very good client of CouchDB  It largely replaces XML  In JSON document, curly braces ({}) wrap objects, and objects are key/value lists. Keys are strings that are wrapped in double quotes (""). Finally, a value is a string, an integer, an object, or an array ([]). Keys and values are separated by a colon (:), and multiple keys and values by comma (,).
  12. 12. JSON documents
  13. 13.  A MapReduce program is composed of  Map(): procedure (method) that performs filtering and sorting (such as sorting students by first name)  Reduce() method that performs a summary operation (such as counting the number of students, yielding name frequencies).  CouchDB uses predefined map and reduce functions in a style known as MapReduce.  These functions provide great flexibility because they can adapt to variations in document structure, and indexes for each document can be computed independently and in parallel. The combination of a map and a reduce function is called a view in CouchDB terminology. Map/Reduce
  14. 14. Map/Reduce
  15. 15.  HTTP is most widely deployed end-user visible protocol in existence. It handles everything from serving, routing, proxying, monitoring, measuring and debugging.  The main way to do anything with CouchDB is via HTTP. Create a database: make an HTTP request; create some data: make an HTTP request; query your data: make an HTTP request; set up replication: make an HTTP request; configure the database: make an HTTP request. You get the idea. HTTP for API
  16. 16. Replication
  17. 17. Eventual consistency(CAP theorem)
  18. 18. Features of CouchDB
  19. 19.  Pros:  We don't need to fit our data into one of those higher-order normal forms  We can change the "schema" of our data at any time  Our data will be indexed exactly for our queries, so we will get results in constant time.  We don’t require plugins such as Adobe Flash player or any.  Cons:  We need to create views for each and every query, i.e. ad-hoc like queries (such as concatenating dynamic WHERE's and SORT's in an SQL),queries are not available.  We will either have redundant data, or we will end up implementing join and sort logic on "client-side" Pros and Cons of CouchDB
  20. 20.  PouchDB  It is the newest project on the scene. PouchDB is a pure JavaScript implementation of CouchDB targeted at the browser. Simply called CouchDB in JavaScript for the browser.  PouchDB is the oldest idea, but it took the longest to realize because browsers weren’t ready for it. Now is the time though that we can build and ship a CouchDB compatible data store and replication engine that lives entirely in your browser. If you want to build web apps that can seamlessly synchronize data between a laptop, a phone and a server and not treat one as a “master” and the other as “slaves”, PouchDB is your solution.  TouchDB  TouchDB i-OSand Android are Objective-C and Java implementations of the same idea, but for mobile phone platforms. They natively integrate into your iOS and Android applications and allow synchronization between themselves, multiple devices, Friends Of CouchDB
  21. 21. CouchDB vs MongoDB
  22. 22. Example
  24. 24. SQL vs NoSQL
  25. 25. SQL vs NoSQL
  26. 26. SQL vs NoSQL
  27. 27. SQL vs NoSQL
  28. 28. SQL vs NoSQL
  29. 29. SQL vs NoSQL
  30. 30.  To open built-in web interface of CouchDB visit  If everything goes fine then it show output as { "couchdb":"Welcome","uuid":"4ba9012bcbbaeaead6808245e5a758fe", "version":"1.6.1", "vendor":{ "version":"1.6.1","name":"The Apache Software Foundation” } }
  31. 31.  You can interact with the CouchDB web interface by using the following url −  This shows you the index page of Futon, which is the web interface of CouchDB
  32. 32. Map function  function(doc) { var Name,Department,Address; if(doc.Name && doc.Department){ Address=doc.Address; Department=doc.Department; Name=doc.Name; emit(Name, Department); } }
  33. 33.   Manual of CouchDB CouchDB-The Definitive Guide,J.Chris Anderson, Jan Lehnardt and Noah Slater References
  34. 34. THANK YOU