Hi,

I have started working on creating a CouchDB data-manager adapter which uses the CouchDB REST API. The open-create database, read and save operations are implemented [1] and tested both with encryption settings and without encryption settings. If you'd like to give it a try, make sure that you have enabled CORS on CouchDB side.

The remaining functions that needs to be implemented are remove and filter. In addition, in order to keep consistent the data-manager API, we should provide a way to remove all the documents in a CouchDB database-store.

a) Removing all documents in a CouchDB database

I'm thinking of fetching all the docs, using _all_docs endpoint which returns _id and _rev (revision), mark them as _deleted and use the bulk insert/update API to delete them. Not sure if this is a proper solution since there might be a huge number of documents.

Another option would be to delete the database-store. This seems to be the worst solution since the documents history will be permanently lost.

Any ideas?

b) Filtering

AFAIK, in order to perform filtering in a CouchDB database, a design document and an appropriate view has to be created. My thought is that the AGJS adapter should not create the view, instead we should assume that the user has created the appopriate views and provide a setting in AGJS where the view endpoint URl can be set. 

Any ideas about filtering and the proper way to be implemented?

Thanks,
Tolis

[1]: https://github.com/tolis-e/aerogear-js/commit/0cf952c36ea0f31aec2a6732d89eb469fd4a3d09