Note that there are some explanatory texts on larger screens.

plurals
  1. POUniqueness of a tuple in couchdb query
    primarykey
    data
    text
    <p>I am trying to make a query which I haven't been able to yet. My permanent view function is following:</p> <pre><code>function(doc) { if('llweb_result' in doc){ for(i in doc.llweb_result){ emit(doc.llweb_result[i].llweb_result, doc); } } } </code></pre> <p>Depending on the key, I filter the result. So, I need this key. Secondly, as you see, there is a for loop. This causes identical tuples in the result. However, I also need to do this for loop to check everything. In here, I just want to know how to eliminate identical tuples?</p> <p>I am using couchdb-python. My related code is:</p> <pre><code>result = {} result['0'] = self.dns_db.view('llweb/llweb_filter', None, key=0, limit = amount, startkey_docid = '000000052130') result['1'] = self.dns_db.view('llweb/llweb_filter', None, key=1, limit=amount) result['2'] = self.dns_db.view('llweb/llweb_filter', None, key=2, limit=amount) </code></pre> <p>As it is understood from key values, there are three different types of keys. I thought that I can extend the 'key' with [doc._id, llweb_result]. I need a key like [*, 2], but I don't know it is possible. Then, use reduce function to group them. This will definitely work, but at this time the problem is how to make a selection query by using only the values [0,1,2]. </p> <p>Edited in 16.08.12</p> <p>Example for 'llweb_result' property of a couchdb record:</p> <pre><code>"llweb_result": { "1": { "ip": "66.233.123.15", "domain": "domain.com", "llweb_result": 1 }, "0": { "ip": "66.235.132.118", "domain": "domain.com', "llweb_result": 1 } } </code></pre> <p>there is only one domain name in one record, but ther could be multiple ips for it. You can consider the record as a dns packet.</p> <p>I want to group records depending on llweb_result (0,1,2). I will do a selection query for them(e.g. I fetch records which contains '1'). But for the example above, there will be two identical tuples in the result.</p> <p>Any help will be appriciated. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload