
The Road to CouchDB 2.0 - g4k
https://blog.couchdb.org/2016/07/25/the-road-to-couchdb-2-0/
======
y0ghur7_xxx
CouchDB is awesome. We evaluated it some time ago¹ and we all thought that the
way it worked, the performance, the management are light years ahead of
everything else in this space. We ended up not using it because it looked like
it was dead. I am so happy that it is not, and I hope this 2.0 release will
bring in some more community love. It absolutely deserves it!

¹[https://news.ycombinator.com/item?id=11757015](https://news.ycombinator.com/item?id=11757015)

(couchbase sales people came answering, even if couchbase is a completely
different product that covers different usecases)

~~~
HodGreeley
Seems like you're confusing Couchbase Mobile and Couchbase Server. And that
wasn't a sales person that responded. It was the head of Couchbase Mobile
engineering.

~~~
y0ghur7_xxx
> Seems like you're confusing Couchbase Mobile and Couchbase Server.

Probably. But is that really my fault?

There is CouchDB, CouchIO, CouchOne, Couchbase, Couchbase Server, Couchbase
Mobile, Couchbase Lite, CouchApps, BigCouch, Touchbase, Membase, Memcached,
MemcacheDB... all different and yet related in a way not at all obvious from
the names alone.

First there was CouchDB, a database created by Damien Katz, a former IBM
developer. Its official name was changed to Apache CouchDB after it became an
Apache project.

A company named CouchIO was founded to work on Apache CouchDB and later
changed its name to CouchOne (by "its name" I mean the company name - not the
database name).

CouchOne (formerly CouchIO) merged with Membase (formerly NorthScale) to form
a new company called Couchbase. Membase (the company) developed Membase (a
product of the same name). Membase was created by several leaders of the
Memcached project and it used the Memcached protocol. After the merger of
CouchOne and Membase, Couchbase continued the development of the Membase
software and later changed its name to Couchbase Server.

Today I think most people believe that Couchbase Server is a new version of
CouchDB but it is in fact a new version of Membase. It still uses the
Memcached protocol and not the RESTful API of CouchDB. Meanwhile CouchDB is
still CouchDB, actively maintained and enhanced as an Apache project.

[http://stackoverflow.com/a/15184612/512324](http://stackoverflow.com/a/15184612/512324)

------
merpnderp
I don't think any discussion of CouchDB is complete without mentioning
PouchDB. And now that CouchDB will have clustering out of the box, there's all
the more reason to support offline versions of your database in your webapps.

[https://pouchdb.com/](https://pouchdb.com/)

------
brightball
Looks like a very solid release. CouchDB has always had that niche as an ultra
reliable and steady NoSQL DB while being the best of breed option for offline
syncing / healing separated nodes.

It fell behind in terms of perception while Mongo was chasing benchmarks early
on but has seemingly continued to just keep chugging along with it's design
decisions.

General community, "You sure about that? I mean...benchmarks."

Couch, "Yep...we're sure."

* few years later *

General community, "Have you seen CouchDB? This thing is really solid. Did you
ever read that Hacker News thread about how terribly unreliable Mongo is?"

~~~
tormeh
MongoDB is written in C++, C and Javascript. CouchDB is written in Erlang.
It's not weird that it ended up like this.

~~~
markpapadakis
The language, especially the languages you enumerated, rarely have anything to
do with the actual final product's qualities (including it performance,
reliability and ease of use). Mongo is unreliable because too much effort was
spent making it easy to install and use it immediately (it works!) and little
to no care apparently went into anything else. Nothing to do with the choice
of C++ for Mongo, or the choice of Erlang for Couch.

~~~
reddit_clone
I wouldn't be too sure of that. Each language's ecosystem fosters certain ways
of approaching and solving problems.

For example, Erlang/OTP brings a lot to the table. Being functional, it would
protect you against certain types of errors leaving you free to solve more
complex problems. You pay for it with run time performance. String operations
are slow etc.

C++ is very fast and very sharp. Not easy to get everything right. (Some sort
Greenspun's rule would apply here I think. Substitute Erlang for Common Lisp).

~~~
markpapadakis
I understand it is about tradeoffs, and that the benefits and limitations of
every language(in terms of syntax and semantics, and its associated runtime/VM
-- if any) definitely define to a large extent the final product's
characteristics.

I am only saying that Mongo is not unreliable because C++ was selected; it's
unreliable because of architectural choices and lack of care which may or may
not have been intentional.

~~~
tormeh
Crudely put, my point was that the people who freely choose C, C++ and
Javascript (and PHP etc.) are the kind of people who don't care much for
quality. I understand if there are availability or historic (or even sometimes
performance) reasons why someone chose a bad language, but if not I'm a bit
prejudiced towards them. Erlang, in contrast to the aforementioned languages,
is a language for people who plan to do things _properly_.

------
niftich
Summary:

CouchDB 2.0 is a unification of the CouchDB 1.x line (a single-node DB) with
BigCouch (which was a fork by Cloudant that added proper out-of-the-box
clustering).

------
reubano
You have no idea how long I've been waiting for this. I seriously thought
couchdb was dead. Looking forward to more frequent releases in the future.

------
doublerebel
I've had great experiences with Cloudant's service and features, this will be
a huge boon to the open-source community. I've tried the other Couch flavors
and cloud hosts and there is no comparison on features, responsiveness and
stability.

------
sa_su_ke_75
what are the new changes of 2.0 version?

~~~
mark242
Primarily merging the changes that Cloudant (now an IBM product) made to Couch
to turn a fairly simple implementation of NoSQL / MapReduce into a first-class
datastore.

Things like:

* Native Lucene search, which you had to build as a weird add-on for Couch. Now it's full-featured out of the box.

* Geospatial queries, also a weird add-on which only _kind of_ worked in Couch, is also cooked in and is pretty strong now.

* True node clustering and data sharding; Couch has always had really really easy replication between nodes, and getting master-master replication is essentially creating a document on each node. However, you had to store your entire data set on every node, which would grow out of control in a hurry.

* A better auto-compactor. Couch 1.6 does fairly well but it's still a weird cron-based thing that can still fail horribly. The auto-compactor in Cloudant/Couch 2.0 is pretty solid and you don't have to worry about massive spikes in disk space consumption.

~~~
rakoo
Thanks for this list. One of the pain points of CouchDB was management of
users: there is only database-level granularity, which is not enough for many
applications (and one-database-per-user may not be practical). I know that
Couchbase Sync Gateway uses channels
([http://developer.couchbase.com/documentation/mobile/current/...](http://developer.couchbase.com/documentation/mobile/current/develop/guides/sync-
gateway/channels/developing/index.html)) that look interesting.

Do you know if there has been changes on this side for CouchDB 2.0 ?

~~~
y0ghur7_xxx
Managing rights for users on document level granularity was pretty easy in
1.6. A simple js function (it's called a "design document") to handle the
logic and you are done. Just an example:

    
    
        function(newDoc, oldDoc, userCtx) {
            if (userCtx.roles.indexOf('can-write-sessions') !== -1 || userCtx.roles.indexOf('admin') !== -1) {
                return;
            } else {
                throw ({
                    forbidden: 'can-write-sessions role missing'
                });
            }
        }
    

Why do you think that the Couchbase Sync Gateway is better?

~~~
rakoo
Validation functions give you control on writing, but there is no control on
reading: everybody can read everything. That's more or less by design, couchdb
would encourage you to create another db for another set of permissions.

Couchbase's channels allow you to segregate docs with different read (or
write) rights inside the same db.

------
_Marak_
CouchDB has not let me down once in over seven years of production usage.

I'm not sure what other software I could say that about.

~~~
lokedhs
Same here. The core of our chat application is centred around CouchDB and
RabbitMQ. Neither of which have ever let us down.

It can't be a coincidence that both of them are written in Erlang.

------
carterschonwald
I'm pretty confused about where the couchdb repo lives. Can anyone point me to
it?

Oddly:
[https://github.com/couchbase/couchdb?files=1](https://github.com/couchbase/couchdb?files=1)
seems to be more like the code than any of the Apache stuff

~~~
gtirloni
CouchDB != Couchbase

[https://github.com/apache?query=couchdb](https://github.com/apache?query=couchdb)

~~~
carterschonwald
No shit. Now explain to me why the Apache version is split into like 20
different rebar git repos but has had some core parts untouched for 1-2 years?
[https://github.com/apache/couchdb-
couch/tree/master/src](https://github.com/apache/couchdb-
couch/tree/master/src)

------
mark_l_watson
I am going to give CouchDB another look. I used to use it a lot, and
experimented with BigCouch, but I didn't used to like JavaScript, so doing
views, etc. was a pain. Now, I don't dislike JavaScript so much and CouchDB
fits some use cases I have.

~~~
lokedhs
CouchDB supports writing views in Erlang, if you prefer that. It's also faster
than Javascript, although it changes some of the ordering semantics of the
resulting views.

I decided to write my views[1] in Parenscript[2]. Might not be for everybody,
but it makes them fit a lot better in the rest of the application.

[1]
[https://github.com/cicakhq/potato/blob/72e162a95332e8979d865...](https://github.com/cicakhq/potato/blob/72e162a95332e8979d8659e7dc0f2e9d0da0c23c/src/potato/views.lisp#L296)

[2] [https://common-lisp.net/project/parenscript/](https://common-
lisp.net/project/parenscript/)

------
refrigerator
We've been using a self-hosted CouchDB 1.6.x instance on AWS, and actually a
few days ago decided to try hosting the pre-RC version of 2.0. What are the
benefits of using a hosted service like Cloudant over self-hosting?

------
noinsight
Exciting news, I just started using CouchDB in a new project and it works
really well.

Is the new Fauxton interface included? The old GUI feels more like a proof of
concept than an actual user interface. Fauxton would be appreciated.

~~~
refrigerator
yeah, Fauxton comes included in 2.0 (and it's really good!)

------
dahjelle
If I recall correctly, built-in clustering and the new Mango query language
are the big new features. Are there others?

------
gwbas1c
I thought CouchDB was abandoned years ago?

~~~
Xylakant
it's been alive and kicking all the time with various interesting
implementations that can sync back to couch, for example pouchdb for browsers
and/or mobile websites: [https://pouchdb.com/](https://pouchdb.com/)

~~~
mwambua
Thanks for the link. PouchDB seems to be a great example of an app that
inherently works better with CouchDB/Cloudant than it would with MongoDB.

~~~
Xylakant
absolutely. I know some projects that implemented a mobile app with
offline/sync capability using the couch/pouch combination. I haven't
participated personally but from what the colleagues tell me it's working
pretty well. (for all values of well that you can have when it comes to
offline/sync. it's a tough problem.)

~~~
HodGreeley
You can take a look at Couchbase Mobile for native client offline+sync
capabilities, too. PouchDB integrates with Couchbase Sync Gateway, so the
combo is versatile.

