Does partialUpdateObject return a promise

Im using Algolia in server side code:

await algoliaIndex.partialUpdateObject({
rating: newRating,
objectID: userId
}, function (err, content) {
if (err) {
console.log("The error updating the profile picture in Algolia is: " + err.message)
} else {
console.log(content);
}
});

However the server code doesn’t update the object, it seems that the server finishes the function without waiting for the update to finish

Hi @andrey.valverde.sole,

Thanks for contacting Algolia. I want to make sure we answer as best as possible.

By this:

the server code doesn’t update the object, it seems that the server finishes the function without waiting for the update to finish

Do you mean that your code completes execution and, then, when you check the index your object update is not immediately visible in the Algolia dashboard?

All Algolia write requests are asynchronous by design.

It means that when you add or update an object to your index, our servers will reply to your request as soon as they understood the write operation. The actual insert and indexing will be done after replying to your code.

You can wait for a task to complete by using the `taskID’ and the waitTask method.

You can read more about asynchronous methods here.