In my Cloud Firestore database, i have a collection of documents including a created timestamp.
Env.docRef.collection('collect').add({
name: this.name,
active: true,
created: firebase.firestore.FieldValue.serverTimestamp()
}).then(function(docRef) {
......;
}.bind(this));
When i need to update/disable one document, i would like to create a duration field that represent the time since the document was created.
Env.docRef.collection('collect').doc(this.id).update({
active: false,
ended: firebase.firestore.FieldValue.serverTimestamp(),
duration : ???
}).then(function() {
....;
})
.catch(function(error) {
....;
});
Is there any option to build this duration in the query ?