How to pass admin.firestore.FieldValue.serverTimestamp() to the update() method? I want to insert this in an array, like this:
import * as functions from \'
As detailed in the error message you receive, "FieldValue.serverTimestamp()
cannot be used inside of an array".
Which is what you do with:
const time = admin.firestore.FieldValue.serverTimestamp();
await amisA.update({
[`amis.${numeroSender}`] : [time,connaissanceABBA,version]
});
});
You might have to change your data model and, for example, replace your array by a map, as follows:
const time = admin.firestore.FieldValue.serverTimestamp();
await amisA.update({
[`amis.${numeroSender}`] :
{
connaissanceABBA: connaissanceABBA,
version: version,
ts: firebase.firestore.FieldValue.serverTimestamp()
}
});
});