Couchbase - get doc if value of key is empty (i.e. has length 0 )
<p>I have a View in Couchbase that I use to retrieve my data. Simplified, my data bucket contains:</p>

<pre><code>{
    "id" : 123,
    "key" : "some value"
},
{
    "id" : 456,
    "key" : ""
}
...
</code></pre>

<p>and I want to get all the docs where 'key' is present, but its value is empty.</p>

<p>If I use a view like this:</p>

<pre><code>function (doc, meta) {
  if(doc.key)
    emit([doc.id], doc);
}
</code></pre>

<p>I get both the JSONs above, if I use a view like this:</p>

<pre><code>function (doc, meta) {
  if(doc.key &amp;&amp; doc.key == "")
    emit([doc.id], doc);
}
</code></pre>

<p>I get none of them.
I want to get the json with id = 456. What is the correct syntax?</p>