DocumentReference washingtonRef = db.collection("cities").document("DC");
// Atomically increment the population of the city by 50.
final ApiFuture<WriteResult> updateFuture =
washingtonRef.update("population", FieldValue.increment(50));
// ...
const washingtonRef = db.collection('cities').doc('DC');
// Atomically increment the population of the city by 50.
const res = await washingtonRef.update({
population: FieldValue.increment(50)
});
$cityRef = $db->collection('samples/php/cities')->document('DC');
// Atomically increment the population of the city by 50.
$cityRef->update([
['path' => 'regions', 'value' => FieldValue::increment(50)]
]);