I need to update collection and return updated value. My code is:
const someFunction = async () => {
const { value } = await dataStore.customerSettings.findOneAndUpdate(
{ organizationId },
{ $push: { archivedSuppliers: archivedSupplier } }
);
return value;
}
Problem is that the value is equal to collection object before update. Why is it? And how to get updated value?