Bigbohne
Bigbohne

Reputation: 1356

CouchDB: Get result from a view IN a view

I want to reuse outputted data from a view in another view. like this reduced and grouped data:

{"rows":[
{"key":"cool","value":3},
{"key":"einzigartig","value":1},
{"key":"mega","value":1},
{"key":"nice","value":1},
{"key":"spitze","value":1},
{"key":"super","value":2}
]}

...because I want to interchange key <> value so that the output gets sorted by value. This is mainly for sorting tags from documents by count, descanding.

Sorry 4 my bad english :)

Best regards

Upvotes: 4

Views: 186

Answers (1)

JasonSmith
JasonSmith

Reputation: 73722

That is a great idea, and many people want to do it. Unfortunately, there is no automatic way to "sort by value." You will have to insert the rows back into the database. (You can use the current database, or use a dedicated database just for this sort.)

I think somebody will make a tool to do this one day. However, now, you need to do it in your own application. Good luck!

Upvotes: 1

Related Questions