title: Query nested property in Mongoose (without dot notation)
body: <p>I am trying to query MongoDB using Mongoose to find documents based on the value of a nested property.</p>
  
  <pre><code>var Obj = new mongoose.Schema({
      mainProperty: {
        nestedProp1: String
        nestedProp2:String
      }
  })
  </code></pre>
  
  <p>Due to the way the data is received, I need to perform the query without dot notation (as seen below).</p>
  
  <pre><code>Obj.find({'mainProperty.nestedProp': 'value'})
  </code></pre>
  
  <p>The code above will get me the correct results, but I need to pass in the query conditions in the format below.</p>
  
  <pre><code>Obj.find({ mainProperty: { nestedProp1: 'value' } })
  </code></pre>
  
  <p>I'm passing in the entire query object as an argument from on the client side, rather than developing the query on the server. By the time it hits the server, the code above appears as seen below.</p>
  
  <pre><code>Obj.find(queryCondition)
  //queryCondition holds a value of { mainProperty: { nestedProp1: 'value' } }
  </code></pre>
  
  <p>Since there are two properties nested within mainProperty, it is not valid to perform the search above. It will search for documents that have mainProperty equal exactly to what is passed in following the colon (meaning documents that have a value equal to nestedProp1 and do not have a nestedProp2).</p>
  
  <p>Is there another way to call this (without dot notation or editing the object itself) where it will query for the value of nestedProp1 rather than the value of mainProperty?</p>