apache / couchdb

Seamless multi-master syncing database with an intuitive HTTP/JSON API, designed for reliability
https://couchdb.apache.org/
Apache License 2.0
6.12k stars 1.02k forks source link

RFC: Simpler API #1496

Open wohali opened 5 years ago

wohali commented 5 years ago

@janl:

Dale Harvey, “there are five ways to read data from CouchDB, it’s confusing” paraphrased

@nolanlawson:

Some inspiration:

Pouchy in particular is one I like a lot. :smile:

@daleharvey :

So I see a lot of people asking which api should they use to get results from a database, we have get, bulkGet, changes, revsDiff, allDocs, query/mapreduce off the top of my head, each of those takes very different parameters, has very different performance characteristics and call almost be useful for very similiar situations.

We actually do a decent job with writes, I am not so much opposed to the amount of ways to read but their inconsistencies, we can put, post, delete and bulk_docs but they are all consistent and can be implemented with bulk_docs

In PouchDB I think we have generally agreed about moving towards mango / pouchdb-find queries, completely dropping mapreduce from core. Hopefully as that goes forward we can look at replacing some of the other core read APIs (allDocs, changes etc) with find. At the very least it means no adding new read APIs :)

And I just remembered why this was brought up in the first places, someone asked for allLocalDocs and I would be hugely against that, we should be working on improving our current primitives (filtered replication), querying etc instead of adding new special case apis

wohali commented 5 years ago

@iilyak rightfully points out that we may well need a versioned API for this as well.