WriteBatch.update requires at least 3 arguments
landrykapela opened this issue · 1 comments
landrykapela commented
Hi there! I'm getting this error
Error [FirebaseError]: Function WriteBatch.update() requires at least 3 arguments, but was called with 2 arguments.
According to the documentation and examples therein, writeBatch.update() needs only 2 arguments: the document reference and the data object.
My Working Environment:
Ubuntu 18.04
Node v12.4.0
npm 6.9.0
firebase 6.2.3
samtstern commented
@landrykapela sorry this somehow slipped by me so I realize you probably already moved on!
There are two versions of update:
https://firebase.google.com/docs/reference/js/firebase.firestore.WriteBatch.html#update
Version 1
update(documentRef: DocumentReference, data: UpdateData): WriteBatch
Version 2
update(documentRef: DocumentReference, field: string | FieldPath, value: any, ...moreFieldsAndValues: any[]): WriteBatch
So if your second argument is a string or a FieldPath, you need at least three arguments.