CouchDB Interview Questions and Answers

1.What is CouchDB?

CouchDB is a database that completely embraces the web. Store your data with JSON documents. Access your documents and query your indexes with your web browser, via HTTP. Index, combine, and transform your documents with JavaScript. CouchDB works well with modern web and mobile apps. You can even serve web apps directly out of CouchDB. And you can distribute your data, or your apps, efficiently using CouchDB’s incremental replication. CouchDB supports master-master setups with automatic conflict detection.

CouchDB comes with a suite of features, such as on-the-fly document transformation and real-time change notifications, that makes web app development a breeze. It even comes with an easy to use web administration console. You guessed it, served up directly out of CouchDB! We care a lot about distributed scaling. CouchDB is highly available and partition tolerant, but is also eventually consistent. And we care a lot about your data. CouchDB has a fault-tolerant storage engine that puts the safety of your data first.

2.State the use of CouchDB?

Ans: Uses of CouchDB are as stated;

  • It can be used directly to write a client’s application without the use of any other server reducing the development time.
  • It helps to replicate the database of client and the filter feature helps to replicate the database of the specific user.

3.Explain the advantages of CouchDB?

Ans: Some of the advantages of CouchDB are:-
  • Multi-Version Concurrency Control (MVCC) Support
  • Incremental Replication
  • Availability
  • Partition Tolerance
  • Browser Based GUI
  • ACID Properties

This is a fundamental CouchDB interview question

4.In which language CouchDB’s early work was started?

Ans: CouchDB early work was started in C++. But later, it was replaced by Erlang OTP platform.

Erlang has proven as an excellent match for this project.

5.Why Does CouchDB Not Use Mnesia?

Ans: Several reasons:

  • The first is a storage limitation of 2 gig per file.
  • The second is that it requires a validation and fixup cycle after a crash or power failure, so even if the size limitation is lifted, the fixup time on large files is prohibitive.
  • Mnesia replication is suitable for clustering, but not disconnected, distributed edits. Most of the “cool” features of Mnesia aren’t really useful for CouchDB.
  • Also Mnesia isn’t really a general-purpose, large scale database. It works best as a configuration type database, the type where the data isn’t central to the function of the application, but is necessary for the normal operation of it. Think things like network routers, HTTP proxies and LDAP directories, things that need to be updated, configured and reconfigured often, but that configuration data is rarely very large.

6. What is the difference between CouchDB and RDBMS?

S.noCouchDBRDBMS
1.Data is stored in documents in CouchDBData is stored in tables in RDBMS
2.Replication is easy in CouchDBReplication is difficult in RDBMS

7. Please explain couchdb vs mongodb?

S.noCouchDBMongoDB
1.In CouchDB, the records are stored in the documents in the database.In MongoDB, the records are stored in the collection in the database
2.Master-Master replication in CouchDBMaster-Slave replication in MongoDB
3.CouchDB is written in ErlangMongoDB is written in C++
4.In CouchDB, the interface is REST/HTTPIn MongoDB, the interface is TCP/IP Custom Protocol
5.Slower than MongoDBFaster than CouchDB

8.What Is Couchdb Kit?

Ans: The Couchdb Kit is used to provide a structure on your Python applications to control and get entry to Couchdb. This package gives full featured  and easy customer to control and get right of entry to Couchdb. It lets you maintain databases,  to view get entry to, Couchdb server and doc managements. Mostly python items are meditated by way of the gadgets for comfort. The Database and server objects are used easily  as the usage of a dict.

9.Enlist the main features of CouchDB.

  • JSON Documents
  • RESTful Interface
  • N-Master Replication
  • Built for Offline
  • Replication filter

10.How can we connect to remote CouchDB?

Ans: On the local machine,set up an ssh tunnel to your server and tell it to forward requests to the local port 5984 to the remote server’s port 5984:

123 $ ssh -L5984:127.0.0.1:5984 ssh.example.com

11. How to use transactions with CouchDB?

Ans: CouchDB makes the use of a model which is known as an ‘Optimistic Currency’ model. ‘Optimistic Currency’ model grants approval to send a document version with the CouchDB update. CouchDB scans the document version, and if the present document version does not tally with document version which was was sent, then CouchDB rejects the change in the release.

12. Explain the difference between SQL and CouchDB?

S.noSQLCouchDB
1.SQL stores the data by using RDBMSCouchDB stores the data in the JSON document.
2.SQL prefer an automatic transmissionCouchDB prefers a manual transmission
3.SQL is written in C, C++CouchDB is written in Erlang

13.Is CouchDB used in the Software industry?

Ans: CouchDB is very popular now a day, and many companies are using CouchDB.

These are the essential features of CouchDB:

  • CouchDB can be replicated across multiple server instances.
  • CouchDB has various libraries for the language of your choice.
  • It has fast indexing and retrieval
  • It has a REST-like interface for document insertion, updates, recovery, and deletion.
  • CouchDB supports JSON-based document format, i.e., easily translatable across different languages.

That’s why the software companies use CouchDB.

14.So is CouchDB now going to written in Java?

Ans: Erlang is a great fit for CouchDB and I have absolutely no plans to move the project off its Erlang base. IBM/Apache’s only concerns are we remove license incompatible 3rd party source code bundled with the project, a fundamental requirement for any Apache project. So some things may have to replaced in the source code (possibly Mozilla Spidermonkey), but the core Erlang code stays.
An important goal is to keep interfaces in CouchDB simple enough that creating compatible implementations on other platforms is feasible. CouchDB has already inspired the database projects RDDB and Basura. Like SQL databases, I think CouchDB needs competition and a ecosystem to be viable long term. So Java or C++ versions might be created and I would be delighted to see them, but it likely won’t be me who does it.

15.What does IBM’s involvement mean for CouchDB and the community?

The main consequences of IBM’s involvement are:
– The code is now being apache licensed, instead of GPL.
– Damien is going to be contributing much more time!

16.What is the use of CouchDB?

Ans: CouchDB allows you to write a client side application that talks directly to the Couch without the need for a server side middle layer, significantly reducing development time. With CouchDB, you can easily handle demand by adding more replication nodes with ease. CouchDB allows you to replicate the database to your client and with filters you could even replicate that specific user’s data.
Having the database stored locally means your client side application can run with almost no latency. CouchDB will handle the replication to the cloud for you. Your users could access their invoices on their mobile phone and make changes with no noticeable latency, all whilst being offline. When a connection is present and usable, CouchDB will automatically replicate those changes to your cloud CouchDB.
CouchDB is a database designed to run on the internet of today for today’s desktop-like applications and the connected devices through which we access the internet.

17.How can you do replication?

Ans: Replication: Replication synchronizes two copies of the same database; these databases live on the same server or can be live on two different servers. If you change one copy of the database, replication will send the details to another copy.

For replication, first you have to send request of HTTP to CouchDB with a source, and a target database and CouchDB will send the changes from source to target.

Let’s see, how replication looks like:

  1. POST /_replicate with a post body of </li>    
  2. {“source”:”$source_database”   
  3. ,   
  4. “target”:”$target_database”}  

Here $source_database and $target_database can be the names of local database or full URIs of remote databases. Both databases need to be created before they can be replicated from or to.

18.Is it possible to communicate to CouchDB without going through HTTP/ API?

CouchDB’s data model and internal API map the REST/HTTP model in a very simple way that any other API would inherit some features of HTTP. However, there is a plan to refractor CouchDB’s internals to provide a documented Erlang API.

19.How is PouchDB different from CouchDB?

PouchDB is a CouchDB client, due to which we can easily switch between a local database or an online CouchDB instance without changing any of the application’s code.

Some of the differences are:

  • View Collation:CouchDB uses ICU to order keys in a view query whereas in PouchDB keys are in ASCII ordered.
  • View Offset:CouchDB returns an offset property in the view results. In PouchDB, offset just mirrors the skip parameter rather than returning a true offset.

20.Enlist basics of CouchDB?

  • All the Items stored in the database is documents.
  • Each documents has units called, fields , and fields are key and value pair.
  • Each document has an unique id to identify them “_id” being the key and the value of each document must be unique.
  • Database operations are done through REST Style http requests.
  • CouchDb’s responses are in JSON format etc.