I'm reading CouchDB in Action and they make use of a doctype in their
examples. This doctype attribute is used in your Map functions to
easily filter out the specific types you want. Example:

if (doc.doctype == "User") // we have a user...

CouchDB: A Definitive Guide, on the other hand, makes use of duck
typing. Essentially you determine that a document is a duck if it
quacks and flies:

if (doc.quacks && doc.flies) // Looks like a duck..

What are the pros and cons of each approach? Which one do you guys use and why?

Reply via email to