title: fetch a particular value using node js and mongodb
body: <p>I have to try to fetch a field value from MongoDB using Node.js. But it shows me <code>undefined</code> in my console. My requirement is to print the data in the console or browser from MongoDB using Node.js.</p>
  
  <p>1). This is my node js</p>
  
  <pre><code>this.levelChange = function(req, res, next){
      try{
          var query = {'level_num':2};
          QuizLevel.find(query,function(err,data){
              var a = data.min_score;
              console.log(a);
              res.send(a);
          });
      }catch(err){
          console.log("Error");
          return next(err);
      }
  };
  </code></pre>
  
  <p>2). This is my js-schema</p>
  
  <pre><code>{
      _id:{type:String},
      age:{type:Number},
      level_num:{type:String},
      min_score:{type:String},
      max_questions:{type:String}
  }
  </code></pre>
  
  <p>3).This is my console output</p>
  
  <pre><code>undefined
  </code></pre>
  
  <p>4). This is my JSON data</p>
  
  <pre><code>{
    "age":5,
    "level_num":1,
    "min_score":10,
    "max_questions":30
  },
  {
    "age":5,
    "level_num":2,
    "min_score":12,
    "max_questions":33
  }
  </code></pre>