couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mickael.bai...@free.fr
Subject the feature of my dream
Date Thu, 17 Feb 2011 09:10:05 GMT

Hello devs,

I hope this thread will bring some interesting ideas. Using Couch for a few years now, there
is one feature I think would add great powerb. Note that any new function name/query option
name I use is only to explain my point.

So let's say I have a design doc "foo" with a "bar" map function being :

function(doc) {
	emitIndexedObject({color: "blue", shape: "circle", active: true},null);
	emitIndexedObject({color: "blue", shape: "circle", active: false},null);
	emitIndexedObject({color: "red", shape: "circle", active: false},null);
}

(of course static values in this example would certainly, in real life, be issued from the
"doc")

Then I can query this view like :

/_design/foo/_view/bar?indexes={active:true}
=>
{
total_rows: ...,
offset: ...,
rows:
[
	{
		id: ...,
		key: {color: "blue", shape: "circle", active: true},
		value: ...
	}
]
}

/_design/foo/_view/bar?indexes={color:"blue"}
=>
{
total_rows: ...,
offset: ...,
rows:
[
	{
		id: ...,
		key: {color: "blue", shape: "circle", active: true},
		value: ...
	},
	{
		id: ...,
		key: {color: "blue", shape: "circle", active: false},
		value: ...
	}
]
}

/_design/foo/_view/bar?indexes={color:"blue",active:false}
=>
{
total_rows: ...,
offset: ...,
rows:
[
	{
		id: ...,
		key: {color: "blue", shape: "circle", active: false},
		value: ...
	}
]
}

Hope you get the idea.

What are your thoughts on this ?

Regards,

Mickael

Mime
View raw message