问题
There is a method provided by firestore to increment a numeric value.
But I was not able to use the function because it is undefined.
I tried updating firebase in npm, tried reinstalling firebase. I currently have the 5.10.1 version of firebase.
import firebase from "../base";
...
someHandler = () => {
someRef.update({
count: firebase.firestore.FieldValue.increment(1)
});
}
回答1:
The problem is that the FieldValue is not accessible through the app instance.
So I solved my problem by importing directly from "firebase" instead of my local file which exports an initialized firebase instance.
来源:https://stackoverflow.com/questions/55897154/unable-to-use-firebase-firestore-fieldvalue-increment