CouchApp function deprecation
IBM Cloudant, the Database-as-a-Service based on the Apache CouchDB project, is giving notice that the following features are deprecated:
- show functions - used to modify the format of the response when requesting a single document from the database. Show functions are accessed via URLs of the form:
/<db>/_design/<design-doc>/_show/<show-name>/<docid>. See CouchDB docs on Show Functions.
- list functions - similar to show functions, but applied to the output of MapReduce views. List functions are accessed via URLs of the form
/<db>/_design/<design-doc>/_list/<list-name>/<view-name>. See CouchDB docs on List Functions.
- rewrite functions - used to embody routing logic in CouchApps. Rewrite functions are accessed via URLs of the form
/<db>/_design/<design-doc>/_rewrite/<path>. See CouchDB docs on Rewrite Functions.
- update functions - used to carry out business logic within the database e.g. adding a timestamp to all document writes. Update functions are accessed via URLs of the form
/<db>/_design/<design-doc>/_update/<update-name>/<doc-id>. See CouchDB docs on Update Functions
These four features are already deprecated in Apache CouchDB and scheduled to be removed from the code in CouchDB 4.0. None of these features are exposed in our Cloudant SDKs.
Photo by Hal Gatewood on Unsplash
Although these features are deprecated, they will not be removed from the service yet. We may completely remove this features in due course, but will leave them operable for the time being to give customers time to modify their applications. As deprecated features, they will not appear in our documentation, their use is not recommended and they will not be supported by our Support team.
Show and List function simply transform single documents and view rows, respectively, within Cloudant before returning data to the client. This functionality can be easily reproduced by transforming Cloudant’s usual JSON reponses on the client side.
Rewrite functions are used in CouchApps, where a web application is hosted by Cloudant - CouchApps were deprecated in October 2021 so application hosting must be undertaken by a separate web server or hosting provider which can perform the routing logic.
Update functions have two main use-cases:
- Modifying a document prior to writing - this logic can be transferred into client-side application logic instead i.e. if you need a timestamp recording inside every document written, add this field in your client-side logic.