couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "matt j. sorenson" <m...@sorensonbros.net>
Subject Re: Storing and Grouping IP Addresses in Couch
Date Fri, 19 Oct 2012 13:56:59 GMT
On Fri, Oct 19, 2012 at 8:27 AM, Carl Bourne <carl.bourne@me.com> wrote:

> Hi,
>
> I have a Couch Database that contains a stack of IP address documents like
> this:
>
> {
>    "_id": "09eea172ea6537ad0bf58c92e5002199",
>    "_rev": "1-67ad27f5ab008ad9644ce8ae003b1ec5",
>    "1stOctet": "10",
>    "2ndOctet": "60",
>    "3rdOctet": "129",
>    "4thOctet": "161"
> }
>
> The documents consist of multiple IP that are part of different subnet
> ranges.
>
> I need a way to reduce/group these documents based on the 1st, 2nd, 3rd
> and 4th Octets in order to produce a reduced list of subnets.
>
> Has anybody done anything like this before.
>
> Best Regards,
>
> Carl
>

like this?
http://chesterfield.iriscouch.com/samples/_design/samples/_view/ipaddresses?group=true

note that it may be ill-advised to use keys that begin w/a numeric, like
1stOctet... might be safer to use e.g. "octet1" "octet2" etc... just
thinking out loud.

--
*matt j. sorenson*

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message