title: NodeJS class always return the same value
body: <p>In NodeJS, I tried to create 2 object of a same class. However, these 2 object are always the same despite having different values. Here is the class. </p>
  
  <pre><code>function reading(){
      var readingArr = [];
  };
  
  reading.prototype.dbValue = function(counter, limit, type, mIndex) { 
      db.data.find({ 'type': type }).limit(limit).sort({timestamp:-1}).skip(counter, function(err, docs){
          readingArr = [];
  
          if( docs != 'undefined'  ){
              for(var i=0; i&lt;limit; i++){
                  readingArr.push(docs[i].measurement[mIndex].value.toFixed(2)); //2 Decimal Placet;
              }
          }
      });
  
      if(typeof readingArr == 'undefined'){
          readingArr = [];
      }
      return readingArr;
   };
  </code></pre>
  
  <p>Here is the object creation. </p>
  
  <pre><code>var spo2 = new reading(); 
  var spo2Arr = spo2.dbValue(0, 5, 'Oximeter', 1);
  
  var temp1 = new reading(); 
  var temp1Arr = temp1.dbValue(0, 5, 'Temperature', 0);
  </code></pre>
  
  <p>Both spo2Arr and temp1Arr return the same value despite having different value in the database. Example</p>
  
  <p>spo2Arr:  98.00<br>
  temp1Arr: 98.00
  <br><br>
  spo2Arr: 37.91<br>
  temp1Arr 37.91</p>
  
  <p>May I know how to create two unique object in NodeJS?</p>