title: Match key name and show document in Mongodb?
body: <pre><code>Json Structure:
      "_id" : ObjectId("55d6cb28725f3019a5241781"),
          "Number" : {
              "value" : "1234567",
          },
          "DeviceID" : {
              "value" : "01",
          }
          "type" : {
              "value" : "ce06"}
  </code></pre>
  
  <p>Now i want to find only those keys document which start from /dev/.</p>
  
  <p>i tried this script:</p>
  
  <pre><code>var cur = db.LIVEDATA.find({"ProductIMEIno.value":"359983007488004"});
    cur.forEach(function(doc){
    var keynames = Object.keys(doc);
    print('the length is '+keynames.length);
    for(var i=0;i&lt;keynames.length;i++){
    if(keynames[i].match(/Dev/)){
    print("the name is "+keynames); }}} )
  </code></pre>
  
  <p>but this is not working properly.</p>
  
  <p>Desired Output;
  Only this document should show on the basis of key name search.</p>
  
  <pre><code>  "DeviceID" : {
                  "value" : "01",
  </code></pre>