couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jens Alfke <j...@couchbase.com>
Subject Re: Design docs and javascript function unreadable...?
Date Sun, 23 Dec 2012 06:53:55 GMT

On Dec 19, 2012, at 5:32 PM, Scott Weber <scotty2541@sbcglobal.net<mailto:scotty2541@sbcglobal.net>>
wrote:

I cannot see how manually creating a slightly more complex function then these
examples would not be begging for mistakes when forced to de-beautify it
manually for loading in through FUTON or curl.

Then don’t edit complex design docs using Futon or curl. Doing so is like trying to edit
a PNG file using a raw hex editor.

There is no way to just tell "validate_doc_update" to load a function from a
whatever.js file?  So the function can remain readable?

If it were in a file it wouldn’t replicate. Part of the point of design documents is that
they replicate along with the rest of the database.

In any case, I don’t think it’s a good idea to complicate CouchDB’s storage model just
to avoid the need to use a tool to assemble complex design documents. It’s really quite
easy to use your favorite scripting language to encode JSON data and PUT it to a design document.
Or you could use CouchApp, which is kind of like that on steroids.

Alternatively, someone could improve Futon to make the contents of design documents more easily
editable. For example, the web UI in Couchbase Server 2.0 has a quite nice map/reduce editor
that even has niceties like auto-indenting of the JavaScript code.

—Jens

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message