When working with asynchronous functions, such as waiting for a response from the server in JavaScript, you use promises or callbacks to wait for a response.
from the pouchdb docs , we can read that they provide a completely asynchronous API.
Callback :
db.get('mittens', function (error, doc) { if (error) {
Promise Version :
db.get('mittens').then(function (doc) {
source share