In the following code, why doesn't the promise inside get_dbinfo resolve prior to executing .then(result) in the calling code block?
My understanding is that the code inside the new Promise will complete before returning to the .then part of the calling statement.
dbFuncs.get_dbinfo()
.then((result) => {
count = result.info.doc_count
if (count < 500){perPage = count};
});
function get_dbinfo() {
return new Promise((resolve, reject) => {
return db.info()
.then((result) => {
resolve(result)
}).catch((err) => {
console.log(err);
reject(err)
});
});
}