Database / CouchDB Interview Questions
What are CouchDB show functions and when were they deprecated?
Show functions are server-side JavaScript functions stored in a design document under the shows key. They transform a single document into any output format (HTML, XML, plain text) directly from CouchDB, without requiring a separate application server. When a client calls GET /db/_design/ddoc/_show/func_name/doc_id, CouchDB fetches the document, passes it to the show function, and returns the function's output as the HTTP response.
// In _design/render:
{
"shows": {
"as_html": "function(doc, req) {
if (!doc) { return { code: 404, body: 'Not found' }; }
return {
headers: { 'Content-Type': 'text/html' },
body: '' + doc.name + '
' + doc.description + '
'
};
}"
}
}
GET /mydb/_design/render/_show/as_html/product:001
Show functions were primarily used in CouchApps — self-contained web applications where HTML pages, CSS, JavaScript, and data were all served from a single CouchDB database. The appeal was zero-infrastructure: the database was the entire application stack. Show functions rendered individual documents as HTML pages; list functions (Q20) rendered view query results.
Deprecation: Show functions were officially deprecated in CouchDB 3.0 (2021) along with list functions and the legacy JavaScript-based rewrites system. They are disabled by default in CouchDB 3.x and will be removed in a future major version. The recommended approach is to handle document rendering in your application layer — any web framework can fetch a document via the REST API and render it. The JavaScript query server overhead, security isolation challenges, and limited debugging tooling made CouchApps impractical at scale.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
