couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bryan rasmussen <>
Subject Re: multiple keys query for a view with multiple key outputs
Date Mon, 11 Nov 2013 13:49:32 GMT
Well, yeah I can also do keys query with a GET instead of a POST, for
example the query


on this view
function(doc) {
  emit(doc.ip, {ip: doc.ip, value: doc.value, timestamp: doc.timestamp,
meta: doc.meta, membername: doc.membername});
  emit(doc.ip, {ip: doc.ip, value: doc.value, timestamp: doc.timestamp,
meta: {}, membername: ""});


{\n   NSWindowsNTOperatingSystem = 1,\n
NSWindows95OperatingSystem,\n   NSSolarisOperatingSystem,\n
= {:item1 => 1}\n\nafter that a want to add item2 so after this I have
hash like this:\n\n{:item1 => 1, :item2
is up","timestamp":"2013-05-02T09:15:15.742Z","membername":"pantagruel"}},
by the Antarctic Treaty as everything south of latitude 60°S. AQ
domain names are available to government organizations who are
signatories to the Antarctic Treaty and to other registrants who have
a physical presence in Antarctica. \t  \tNo \tYes .ar \t Argentina. Ok
then. ","timestamp":"2013-01-02T09:15:15.742Z","meta":{},"membername":""}},

Which is what I want, in so far as I have all docs with the two ip number
keys I queried for, but the problem is I want to sort the results by the
timestamp value.

What would be the most efficient way to do that? Since the example data set
above will probably be a lot bigger in real world use it is not going to
work to query from the server and then sort afterwards.


On Mon, Nov 11, 2013 at 11:13 AM, Dave Cottlehuber <>wrote:

> On 11. November 2013 at 10:01:53, bryan rasmussen (
> wrote:
> >
> > Ok, well I can of course make a view that emits the ip and then do
> > keys=["", " 617.253.1101"] etc. etc.
> > But I also want to be able to sort by the timestamp in various ways.
> > How should I do that?
> >
> >
> > Thanks
> Hi Bryan,
> Likely you will want to have a number of different views for these query
> types, as Jens suggests.
> CouchDB is optimised for range queries, but you can also send multiple
> keys in a single request using POST instead of GET
> There are some space efficiencies for using multiple views within the same
> design doc, but obviously you increase rebuild time & also the need to
> rebuild a view because of a change to a different view within the same ddoc.
> A+
> Dave

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