title: MongoDb Why isn't the data being stored in the database?
body: <p>I have this mongodb model: </p>
  
  <pre><code>  let businessLineDashboardRow = new Schema({
      ref: {
        type: String
      },
      riskstatements: {
        type: String
      },
      maximpact: {
        type: String
      },
      controleffectiveness: {
        type: String
      },
      recommendedriskrating: {
        type: String
      },
      frequency: {
        type: String
      },
      impact: {
        type: String
      },
      validatedreviewriskrating: {
        type: String
      },
      rationalforriskadjustment: {
        type: String
      }
    })
  </code></pre>
  
  <p>I started with a simple document insertion:  </p>
  
  <blockquote>
    <p>db.businesslinedashboards.find()</p>
  </blockquote>
  
  <pre><code>{ 
    "_id" : ObjectId("5d10a0a6df45c71a6c9dab26"), 
    "ref" : "R13", "riskstatements" : "blablablablablabla", 
    "maximpact" : "I AM TRYING TO CHANGE THIS VALUE", 
    "controleffectiveness" : "blablablablablabla", 
    "recommendedriskrating" : "blablablablablabla", 
    "frequency" : "blablablablablabla", 
    "impact" : "blablablablablabla", 
    "validatedreviewriskrating" : "blablablablablabla", 
    "rationalforriskadjustment" : "blablablablablabla", "__v" : 0 
  }
  </code></pre>
  
  <p>As you may have noticed, I am trying to change the value of maximpact, by this code:  </p>
  
  <pre><code> BusinessLineDashboard.findOne({
          ref: 'R13'
      }, (err, rowData) =&gt; {
          if (err)
              console.log(err);
          else {
              rowData.maximpact = 'THE DATA GETS STORED IN THE DB SUCCESFULLY'
  
              console.log('rowData: ', rowData.maximpact);
              //In the console: rowData:  THE DATA GETS STORED IN THE DB SUCCESFULLY
          }
   });
  </code></pre>
  
  <p>So I though it worked. But, when I sent a second query for retrieving the table data, I noticed that nothing changed:  </p>
  
  <pre><code>function getTableData(dbtable, callback) {
      dbtable.find((err, tableData) =&gt; {
          if (err)
              console.log(err);
          else {
              callback(tableData)
          }
      }).then((tableData) =&gt; {});
  }
  
  getTableData(BusinessLineDashboard, (BLDtable) =&gt; {
          BLDtable.forEach(rowData =&gt; {
              if(rowData.ref==='R13'){
                  console.log('BLDrow: ', rowData.maximpact);
                  //In the console: BLDrow:  I AM TRYING TO CHANGE THIS VALUE
              }
          })
  })
  </code></pre>
  
  <p>So actually nothing changed. I think this has something to do with the asynchronous nature of JS.<br>
  Any idea why is this happening and maybe how to fix it?<br>
  Thanks!!</p>