couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Newson <robert.new...@gmail.com>
Subject Re: inclusive_end howto
Date Mon, 28 Jun 2010 14:56:51 GMT
the usual way to find all compound keys with the same prefix is;

?startkey=[0]&endkey=[0,{}]

http://wiki.apache.org/couchdb/HTTP_view_API also describes the
?inclusive_end=true/false option.

B.

2010/6/28 Attila Nagy <bra@fsn.hu>:
> Hello,
>
> I have an IP space separated equally and indexed with a key
> (1.1.1.0-1.1.1.10:key 0, .11-.20:key 1, etc).
>
> I would like to query the partition 0, but this doesn't work:
> curl -X GET
> 'http://localhost:5984/subnet_10-85-0-0$16/_design/dhcp/_view/available?startkey=\[0,null\]&endkey=\[0,null\]'
> {"total_rows":254,"offset":0,"rows":[]}
> while this does:
> curl -X GET
> 'http://localhost:5984/subnet_10-85-0-0$16/_design/dhcp/_view/available?startkey=\[0,null\]&endkey=\[1,null\]'
> {"total_rows":254,"offset":0,"rows":[
> {"id":"10.85.128.1","key":[0,"10.85.128.1"],"value":null},
> {"id":"10.85.128.101","key":[0,"10.85.128.101"],"value":null},
> {"id":"10.85.128.103","key":[0,"10.85.128.103"],"value":null},
> {"id":"10.85.128.108","key":[0,"10.85.128.108"],"value":null},
> {"id":"10.85.128.115","key":[0,"10.85.128.115"],"value":null},
> {"id":"10.85.128.117","key":[0,"10.85.128.117"],"value":null},
> {"id":"10.85.128.120","key":[0,"10.85.128.120"],"value":null},
> {"id":"10.85.128.122","key":[0,"10.85.128.122"],"value":null},
> {"id":"10.85.128.129","key":[0,"10.85.128.129"],"value":null},
> {"id":"10.85.128.134","key":[0,"10.85.128.134"],"value":null},
> {"id":"10.85.128.136","key":[0,"10.85.128.136"],"value":null},
> {"id":"10.85.128.14","key":[0,"10.85.128.14"],"value":null},
> {"id":"10.85.128.141","key":[0,"10.85.128.141"],"value":null},
> {"id":"10.85.128.143","key":[0,"10.85.128.143"],"value":null},
> {"id":"10.85.128.148","key":[0,"10.85.128.148"],"value":null},
> {"id":"10.85.128.155","key":[0,"10.85.128.155"],"value":null},
> {"id":"10.85.128.157","key":[0,"10.85.128.157"],"value":null},
> {"id":"10.85.128.16","key":[0,"10.85.128.16"],"value":null},
> {"id":"10.85.128.160","key":[0,"10.85.128.160"],"value":null},
> {"id":"10.85.128.162","key":[0,"10.85.128.162"],"value":null},
> {"id":"10.85.128.169","key":[0,"10.85.128.169"],"value":null},
> {"id":"10.85.128.174","key":[0,"10.85.128.174"],"value":null},
> {"id":"10.85.128.176","key":[0,"10.85.128.176"],"value":null},
> {"id":"10.85.128.181","key":[0,"10.85.128.181"],"value":null},
> {"id":"10.85.128.183","key":[0,"10.85.128.183"],"value":null},
> {"id":"10.85.128.188","key":[0,"10.85.128.188"],"value":null},
> {"id":"10.85.128.195","key":[0,"10.85.128.195"],"value":null},
> {"id":"10.85.128.197","key":[0,"10.85.128.197"],"value":null},
> {"id":"10.85.128.205","key":[0,"10.85.128.205"],"value":null},
> {"id":"10.85.128.207","key":[0,"10.85.128.207"],"value":null},
> {"id":"10.85.128.21","key":[0,"10.85.128.21"],"value":null},
> {"id":"10.85.128.213","key":[0,"10.85.128.213"],"value":null},
> {"id":"10.85.128.218","key":[0,"10.85.128.218"],"value":null},
> {"id":"10.85.128.224","key":[0,"10.85.128.224"],"value":null},
> {"id":"10.85.128.226","key":[0,"10.85.128.226"],"value":null},
> {"id":"10.85.128.23","key":[0,"10.85.128.23"],"value":null},
> {"id":"10.85.128.230","key":[0,"10.85.128.230"],"value":null},
> {"id":"10.85.128.232","key":[0,"10.85.128.232"],"value":null},
> {"id":"10.85.128.239","key":[0,"10.85.128.239"],"value":null},
> {"id":"10.85.128.245","key":[0,"10.85.128.245"],"value":null},
> {"id":"10.85.128.247","key":[0,"10.85.128.247"],"value":null},
> {"id":"10.85.128.251","key":[0,"10.85.128.251"],"value":null},
> {"id":"10.85.128.253","key":[0,"10.85.128.253"],"value":null},
> {"id":"10.85.128.28","key":[0,"10.85.128.28"],"value":null},
> {"id":"10.85.128.3","key":[0,"10.85.128.3"],"value":null},
> {"id":"10.85.128.35","key":[0,"10.85.128.35"],"value":null},
> {"id":"10.85.128.37","key":[0,"10.85.128.37"],"value":null},
> {"id":"10.85.128.40","key":[0,"10.85.128.40"],"value":null},
> {"id":"10.85.128.42","key":[0,"10.85.128.42"],"value":null},
> {"id":"10.85.128.49","key":[0,"10.85.128.49"],"value":null},
> {"id":"10.85.128.54","key":[0,"10.85.128.54"],"value":null},
> {"id":"10.85.128.56","key":[0,"10.85.128.56"],"value":null},
> {"id":"10.85.128.61","key":[0,"10.85.128.61"],"value":null},
> {"id":"10.85.128.63","key":[0,"10.85.128.63"],"value":null},
> {"id":"10.85.128.68","key":[0,"10.85.128.68"],"value":null},
> {"id":"10.85.128.75","key":[0,"10.85.128.75"],"value":null},
> {"id":"10.85.128.77","key":[0,"10.85.128.77"],"value":null},
> {"id":"10.85.128.8","key":[0,"10.85.128.8"],"value":null},
> {"id":"10.85.128.80","key":[0,"10.85.128.80"],"value":null},
> {"id":"10.85.128.82","key":[0,"10.85.128.82"],"value":null},
> {"id":"10.85.128.89","key":[0,"10.85.128.89"],"value":null},
> {"id":"10.85.128.94","key":[0,"10.85.128.94"],"value":null},
> {"id":"10.85.128.96","key":[0,"10.85.128.96"],"value":null}
> ]}
>
> It's obvious that I should give the endkey the IP too to make this work, but
> I don't know it. I use this map only because I have to make queries like: is
> 10.85.128.96 in partition 0? (and also, list all entries in partition 0)
> Is this OK to always query a given partition with startkey=0 and endkey+1
> and null as the other key, or is there a cleaner method?
>

Mime
View raw message