I have a problem. I need the number of users in the PouchDB database. I'm using the allDocs function and everything is fine here. I want to extract it to the variable amunt. Unfortunately, it does not work in my record. What am I doing wrong? Thanks for the answers.
function numberOfUsersInDb(){
var amount = 0;
db.allDocs({
}).then(function (result) {
    amount = result.total_rows;
    return amount
    }).catch(function (err) {
    console.log(err);
});
return amount; }
 
    