Now I have an array with four promises like this:
fieldsForSave: [ Promise { <pending> },
Promise { <pending> },
Promise { <pending> },
Promise { <pending> } ]
Now I just can get each one of four
fieldsForSave.map(async (promise) => {
let result = await promise;
console.log(result);//for example result is { field: 5b1c4558337f87fa32aec69c, isRequired: true }
});
How can I get the resolves like this, I want to use this array to update mongoose schema.
fieldsForSave: [ { field: 5b1c4558337f87fa32aec69b, isRequired: true }
{ field: 5b1c4558337f87fa32aec69c, isRequired: true }
{ field: 5b1c4558337f87fa32aec69d, isRequired: true }
{ field: 5b1c4558337f87fa32aec69e, isRequired: true } ]