title: Mongodb Query To select records having a given key
body: <p>The records in my database are</p>
  
  <pre><code>{"_id":"1","fn":"sagar","ln":"Varpe"}
  
  {"_id":"1","fn":"sag","score":"10"}
  
  {"_id":"1","ln":"ln1","score":"10"}
  
  {"_id":"1","ln":"ln2"} 
  </code></pre>
  
  <p>I need to design a MongoDB query to find all records that have a given key.</p>
  
  <p>For example, if I pass <code>ln</code> as a parameter to the query it shuold return all records in which <code>ln</code>is a key.  The results would be</p>
  
  <pre><code>{"_id":"1","fn":"sagar","ln":"Varpe"}
  
  {"_id":"1","ln":"ln1","score":"10"}
  
  {"_id":"1","ln":"ln2"} 
  </code></pre>