-
Notifications
You must be signed in to change notification settings - Fork 270
Closed
Description
snippets-web/firestore/test.solution-counters.js
Lines 25 to 32 in c5bfca3
function incrementCounter(db, ref, num_shards) { | |
// Select a shard of the counter at random | |
const shard_id = Math.floor(Math.random() * num_shards).toString(); | |
const shard_ref = ref.collection('shards').doc(shard_id); | |
// Update count | |
return shard_ref.update("count", firebase.firestore.FieldValue.increment(1)); | |
} |
The parameter db
is unused in this code example. For the same example in other languages, they do not have this parameter, so it is unneeded here.
Metadata
Metadata
Assignees
Labels
No labels