title: Passing variables into a query in mongoose in the first argument
body: <p>I am using MEAN stack, i have an entry like this in my mongodb</p>
  
  <pre><code>{ "_id" : ObjectId("5577467683f4716018db19ed"),
  "requestMatrix" : { "1698005072" : { "rideId" : "641719948", "status" :"accepted" },"1698005073" : { "rideId" : "641719545", "status" :"rejected" }  }, 
  "partners":[ { "customerNumber" : 1698005072 }, { "customerNumber" : 1698072688 } ]}
  </code></pre>
  
  <p>I want to query the db to return me this entire document based on whether the status is accepted or rejected.</p>
  
  <p>When I run the below query in a command prompt, i get the expected answer</p>
  
  <pre><code>db.joinedrides.find({'requestMatrix.1698005072.status':"accepted"})
  </code></pre>
  
  <p>But when i want to do the same from nodeJs, I am stuck as the number 1698005072 in the above query is a variable, i am not able to write a query for that.</p>
  
  <p>tried something like this</p>
  
  <pre><code>var criteria = "'requestMatrix.'"+customerNumber+"'.status'";
      JoinedRide.find({criteria:"accepted"},function(err,joinedRides){
  
      })
  </code></pre>
  
  <p>where customerNumber will vary for different requests, in the above mentioned case its value is 1698005072</p>
  
  <p>Any help is appreciated.</p>