couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guby <>
Subject Javascript views don't support for loops?
Date Sun, 06 Apr 2008 03:07:18 GMT
I am trying to write a view where I want a for loop to loop through  
one of the parameters in the document and then create several entries  
for the document based on the parameters content.

The view would look something like this:

	if (doc.class == "Entry"){
		for (n in doc.scores){
			map(doc.user, doc.scores[n]);

where doc.scores is an array.

When I am inserting a for (x in y) or for (n = 0; n<10, n=n+1) or  
anything of the kind the view just doesn't execute at all!
Is this a known limitation?
I have to create several entries for each document based on this array!
Is there a good workaround you guys could suggest?

Best regards

View raw message