This is my function:

```
/* function for add transaction */
function addtransaction(user_id,status,amount,date,description){
  var saved = "";
  function getLastId(){
    Transactions.findOne({}, {}, { sort: { '_id' : -1 } }).lean().exec(function(err, lastTrans) {
        if (err) {
          return 1;
        }else{
          return parseInt(lastTrans.id) + 1;
        }
    });  
  }

  var newId = getLastId();
  var newTransactions = new Transactions({
      id           : newId,
      user_id      : user_id ,
      status       : status ,
      amount       : amount ,
      date         : date ,
      description  : description
  });

  if (newTransactions.save()){
    return true;
  }else{
    return false;
  }     
}/* end function */

```

And this is my console error: 

Can you help me to solve this error?
[enter image description here](https://i.stack.imgur.com/7xatl.png)

I updated my function but there is still error!