How to give muliple composite keys in startkey and endkey to search in views

Hi, i create a view which emit composite keys

function (doc, meta) {
emit([doc.name,doc.sex,doc.age], doc);
}

i want to get results for multiple composite keys. like [[‘name1’,‘male’,'99],[‘name2’,‘female’,‘99’]]

i have group of names along with sex but i dont have exact value of age so i want to give age in ranges and i want to sort the result based on age.

Please help me how can i get the result.

note i dont have exact value for age…

note that the Couchbase team is working on a new query language that will allow you do query JSON document easily take a look to the developer preview and online demonstration here:

Hello,

One important thing to remember is that all queries you will do in the index/view will be possible from left to right. So if you want to group by gender and age you MUST start with one of these values depending of your business requirement.
Based on your description you will have something like:

function (doc, meta) {
emit([doc.gender,doc.age], null);
}

In addition to the fact that I change the key, I also emit a null value. You should “never” emit the full document in the view. By doing that you will just double the size of your database. You just need to emit the key of your index, and emit a value when it makes sense for your application: calculation, projection, reduce…

If you want for example all the females you will query using these parameters:

?startkey=[“F”]&endkey=[“F”,{}]

If you want all males between 35 and 45:

startkey=[“M”,35]&endkey=[“M”,45]

So as you can see I do a range query using the various values of your compound key.

If you need to get all people (independently of their gender) with an age between 30 and 40 you cannot use this index/view you must create another view that emits either the age only on starts with the age.

I am inviting you to look at the following links:

Regards
Tug
@tgrall

Thank you for your reply…

but my exact question is whether we can give many composite keys in startkey and end key

example my entire data in bucket:
{
{
name:“Sruthi”,
gender:“F”,
age:“23”
}
{
name:“raghun”,
gender:“M”,
age:“24”
}
{
name:“david”,
gender:“M”,
age:“56”
}
{
name:“jeff”,
gender:“M”,
age:“65”
}
{
name:“raghun”,
gender:“F”,
age:“23”
}
}

i want to query data for the name “Sruthi” and “rraghun” and gender “F” and age some range.

startkey=[[“Sruthi”,“F”],[“rraghun”,“F”]]&endkey=[[“Sruthi”,“F”,{}],[“rraghun”,“F”,{}]]

i know it is working for single composite key but how to query for multiple composite keys.

Thanks

Thank you for your reply…

but my exact question is whether we can give many composite keys in startkey and end key

example my entire data in bucket:
{
{
name:“Sruthi”,
gender:“F”,
age:“23”
}
{
name:“raghun”,
gender:“M”,
age:“24”
}
{
name:“david”,
gender:“M”,
age:“56”
}
{
name:“jeff”,
gender:“M”,
age:“65”
}
{
name:“raghun”,
gender:“F”,
age:“23”
}
}

i want to query data for the name “Sruthi” and “rraghun” and gender “F” and age some range.

startkey=[[“Sruthi”,“F”],[“rraghun”,“F”]]&endkey=[[“Sruthi”,“F”,{}],[“rraghun”,“F”,{}]]

i know it is working for single composite key but how to query for multiple composite keys.

Thanks