title: Writing a complex if condition in mongoose efficiently
body: <p>I have a set of conditions on my node app
  where I am trying to implement the following if block - </p>
  
  <pre><code>if(((public==true)&amp;&amp;(varA=="something" || varB == "something")) || (public==false)&amp;&amp;(varA=="something" || varB == "something")&amp;&amp;(varc == "something"))
  </code></pre>
  
  <p>so what I tried to implement was something is - </p>
  
  <pre><code>db.foo.find({"$or":[{"$and":[{e:true},{"$or":[{d:"four"},{c:"seven"}]}]},{"$and":[{e:false},{a:"one"},{"$or":[{c:"three"},{c:"seven"}]}]}]})
  </code></pre>
  
  <p>Now, the variables varA,varB,varC are dynamic so they depend on the user's requests. so I can't write the query object as it is. I will have to write it in an array fashion </p>
  
  <pre><code>( like obj["$or][0]["$and"][e] = true; )
  </code></pre>
  
  <p>or something along these lines.</p>
  
  <p>can I simplify my query more here ? or is there is a better and more efficient way of getting this required collection.</p>