couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jamie Talbot <>
Subject Inlining Linked Document Data
Date Mon, 24 Oct 2011 07:29:15 GMT

With reference to linked documents, is there any support for the idea
of linked document data being inlined into an emitted {_id: XXX}
block, perhaps with a new query parameter such as 'follow_links=true',
rather than being appended when called with 'include_docs=true'?

I know this represents a substantial departure from how things work
now, but it would offer two significant benefits that I can see:

1)  The ability to follow multiple linked docs from a single document
in a single request.  Let's say for a blog post:

function (doc) {
	emit(doc.timestamp, [{_id: doc.category_id}, {_id: doc.user_id}]);

called with follow_links=true which would return for example:

	"key": 'POST010',
	"value": [{
		'_id': 'CAT001',
		'name': 'First Category'
	}, {
	'_id': 'USER004',
	'name': 'Monkey Magic',
	'dob': '1981-02-06'

2) You could combine it with include_docs=true, and be able to
retrieve the source document at the same time.  At the moment when
using this, if I want data from the source and the linked doc, I can
only retrieve one or the other with include_docs, which either forces
me to emit more data from the source, increasing the size of the view,
or else avoid using the link and make multiple requests.

While currently useful for hierarchies, I find the linked docs feature
a little limiting when I want to use it for any other purpose.


Are there any existing ways to achieve the above?




View raw message