RethinkDB Filter lambda 2 fields
<p>I have a bit of a problem with a statement in RethinkDB.</p>

<p>I have the following set of data:    </p>

<pre><code>{
    candidate_details :{
        "name" : "User test 1"
    },
    for_job : "long-id-1234"
}
{
    candidate_details :{
        "name" : "User test 10"
    },
    for_job : "long-id-56789"
}
{
    candidate_details :{
        "name" : "User test 9"
    },
    for_job : "long-id-1234"
}
</code></pre>

<p>When i apply the following statement:</p>

<pre><code>r.table("table").filter(lambda doc:
                                            doc.has_fields({"for_job_details":{"name"}}) &amp;
                                            doc.has_fields({"candidate_details":{"name"}}) &amp;
                                            (
                                                # candidate_query(doc) &amp;
                                                # job_query(doc)
                                                doc['candidate_details']['name'].downcase().match('') &amp;
                                                doc['for_job'].downcase().match('long-id-1234')

                                            ) &amp;
                                            doc['company_id'].eq(company_id)
                                        ).run(rethink_conn)
</code></pre>

<p>It does not return anything.<br>
I want it to return all "candidates" that have the id for job "long-id-1234" and match ""     </p>

<p>What am i doing wrong?   </p>

<p>If i eliminate any of the 2 statements (match), it works, but not together.<br>
Also i want to do it in a single filter.<br>
If i do 2 filters, it works.</p>

<p><strong>EDIT</strong></p>

<p>The problem is NOT caused by the <code>doc.has_fields</code> condition.</p>