CouchDB Weekly News, March 31, 2016

Drupal + CouchDB

Earlier today, Tim Milwood authored a post detailing the work he’s done with Drupal and CouchDB to expose the compatible endpoints with the PHP-based CMS.


grunt-couchdb 0.1.0 (Node) – The best Grunt plugin ever.

Major Discussions

make (see thread)

Jan Lehnardt is proposing shipping CouchDB 2.0 sooner than later and adding integration with all the different operating systems as needed in order to create an intermediate solution allowing to ship 2.0 sooner.

db/_all_conflicts (see thread)

Robert Kowalski and co have a hackweek to work on creating a list of conflicts in Fauxton for every database (provided by CouchDB) to give users better abilities to handle conflict resolution.

Calculating Revision IDs outside erlang… (see thread)

In this discussion Michael Fair recommends changing the term_to_binary computation to use the {minor_version, 1} option in the rev_id calculation, to assist with replicating the md5 for the revision id of documents with floats – which currently is causing a headache.

Releases in the CouchDB Universe

  • chill-rs/chill 0.1.0 (Rust) – Chill is a client-side CouchDB library for the Rust programming language
  • couchdb-iterator 2.0.1 (Node) – A fast and easy to ease CouchDB iterator for views and all documents
  • couchdb-jwt 3.3.1 (Node) – A Node.js server for managing CouchDB authentication through JSON Web Tokens.
  • couch-node 0.0.3 (Node) – Couchdb promise request
  • sneakerjs 0.3.0 (Node) – Entity relationship automation for AngularJS and CouchDB/PouchDB


Opinions and other News in the CouchDB Universe

… and in the PouchDB Universe

CouchDB Use Cases, Questions and Answers

Use Case:

  • CouchDB dev/run for TLS for erlang distribution (RSA or ECC), Robert Newson
  • AvanceDB: An in-memory database implementing a large subset of the CouchDB REST API. AvanceDB has blistering fast document lookup and map/reduce performance. If you are currently using CouchDB and struggle with view build times then AvanceDB should be a seamless replacement for your view workload.

Stack Overflow:

no public answer yet:

PouchDB Use Cases, Questions and Answers

no public answer on Stack Overflow yet:

For more new questions and answers about CouchDB, see these search results and about PouchDB, see these.

Get involved!

If you want to get into working on CouchDB:

  • We have an infinite number of open contributor positions on CouchDB. Submit a pull request and join the project!
  • Do you want to help us with the work on the new CouchDB website? Get in touch on our new website mailing list and join the website team! –
  • The CouchDB advocate marketing programme is just getting started. Join us in CouchDB’s Advocate Hub!
  • CouchDB has a new wiki. Help us move content from the old to the new one!
  • Can you help with Web Design, Development or UX for our Admin Console? No Erlang skills required! – Get in touch with us.
  • Do you want to help moving the CouchDB docs translation forward? We’d love to have you in our L10n team! See our current status and languages we’d like to provide CouchDB docs in on this page. If you’d like to help, don’t hesitate to contact the L10n mailing list on or ping Andy Wenk (awenkhh on IRC).

We’d be happy to welcome you on board!


Job opportunities for people with CouchDB skills

Time to relax!

  • “Watching old Soviet military parades may not seem like the best use of your time, and to be honest, it probably isn’t. But there’s something weirdly transfixing about them. It’s really easy to get drawn in by the pomp and circumstance, to get hypnotized by the bugles and drums and rhythmic marching.” – Relax with hours and hours of Soviet military parades
  • “…making time for stress release is more important than you might think. According to the Mayo Clinic, the more regularly we feel stressed, the harder it is for our bodies to return to our normal ‘non-stressed’ state, meaning that our bodies can become full of stress hormones like adrenaline and cortisol even in low stress situations. This flood of hormones can lead to high blood pressure, sleep problems, heart issues, and even certain forms of cancers.” – The 9 Best Relaxation Videos on YouTube
  • “I find even pubs to be overwhelming, so nightclubs are just awful with all the noise, sound and crowded people. It’s much easier and more comfortable for me to talk to my friends on Skype or Facebook than to force myself into an uncomfortable and intimidating situation.” – ‘I’d rather chill in and relax’: why millennials don’t go clubbing
  • “Stress and anxiety strike almost everyone from time-to-time. It can be made worse by lack of sleep, the wrong mindset and unwanted intrusive thoughts. The collection of articles below describe how to sleep better, change unhelpful thought processes and tackle everyday stress and anxiety.” – Unwind: The Science of Rest, Relaxation and Sleep
  • “Sleep is one of humanity’s great unifiers. It binds us to one another, to our ancestors, to our past, and to the future. No matter who we are, we share a common need for sleep. Though this need has been a constant throughout human history, our relationship to sleep, and our understanding of its vital benefits, has gone through dramatic ups and downs.” – The Sleep Revolution: Transforming Your Life, One Night at a Time

… and also in the news

Drupal ♥ CouchDB

For most web sites and software there are three pillars, code, configuration, and content. Code is always the easy one, stick it in git, then deploy it anywhere with full revisions and accountability. Historically Drupal has struggled with the other two aspects, until Drupal 8, which was launched in late 2015. This added configuration management, stored in yaml files the configuration could now be version controlled alongside the code. Now all that’s left to be solved is content.

Previously in Drupal there have been two main options. Add content in production, or use the Deploy module, which implemented a custom REST API to copy content to another Drupal site. Since it was a custom REST API it wasn’t very well documented, issues were often found and it was difficult to integrate with. The most common suggestion was to just add content in production, this worked for many, however if there were many legal or editorial steps then this was not an option.

During the development of Drupal 8, Dick Olsson, the maintainer of the Deploy module, started to look for a better solution. After a lot of research it seemed all of the content storage and replication problems had already been solved, in CouchDB. Along with Andrei Jechiu and Tim Millwood, Dick developed a suite of contributed modules for Drupal that follow the CouchDB Replication protocol.

Data storage
Drupal doesn’t store revisions for all content, and for the content that is revisionable this is not enforced. Therefore the first step was altering the schema for all content to allow us to store revisions for all content. There were also a bunch of other things we needed to store to be compatible with CouchDB, such as, a revision hash, a sequence ID, and a revision tree. Another issue we had is Drupal has many types of content, and modules can define new types of content, so without looping through all content types, then all content, we had no way of knowing which UUID related to which content. To solve this we created a UUID index in a simple key value store. Many of these features were developed into the Multiversion module.

API endpoints
Drupal 8 core ships with a REST module, which provides a bunch of API end points, we expanded on these to provide all endpoints compatible with the CouchDB protocol. This provided all the needed headers and document attributes required by the protocol. The Drupal content was then normalized (and denormalized) to provide valid JSON-LD documents. The Replication and RELAXed Web Services modules provide all the functionality to expose the CouchDB compatible API endpoints.

Initially the native CouchDB replicator was used to replicate from Drupal to CouchDB, CouchDB to Drupal, and Drupal to Drupal. Tests were then setup to work with PouchDB allowing Drupal to be used as a backend for decoupled web apps.

As part of Google Summer of Code 2015 a student worked on a PHP version of the CouchDB replicator, this was worked into the Drupal modules to allow for replication between CouchDB compatible endpoints via the Drupal UI without using CouchDB.

Drupal now has an awesome content staging solution allowing users to stage content on one site then replicate all content to a live site. It also allows for backing up, or storing content, within a CouchDB database. Then users can also decouple their front-end by replicating content to PouchDB.

Further reading
Drupal Deploy – The team behind this work.
Multiversion – Used for Drupal storage updates.
RELAXed Web Services – Provides the API endpoints.
Deploy – The UI for replicating between sites.
PHP CouchDB Replicator – Replicate using PHP.
Improving Drupal’s content workflow