Incrementing counter throws error
m-rtin opened this issue · 3 comments
m-rtin commented
The following function doesn't work:
func incrementCounter(ref: DocumentReference, numShards: Int) {
// Select a shard of the counter at random
let shardId = Int(arc4random_uniform(UInt32(numShards)))
let shardRef = ref.collection("shards").document(String(shardId))
shardRef.updateData([
"count": FieldValue.increment(Int64(1))
])
}
The FieldValue.increment(Int64(1))
part throws the following error:
Unsupported type: FSTNumericIncrementFieldValue (found in field count) (FIRInvalidArgumentException)
morganchen12 commented
@samtstern do you know what's going on here?
samtstern commented
@morganchen12 nope but we should probably move this over to the iOS SDK repo,
morganchen12 commented
@m-rtin can you share the debug logs from when this error happens? You can enable debug logging with this method.