【问题标题】:Error: [firestore/unknown] java.lang.String cannot be cast to java.lang.Double错误:[firestore/unknown] java.lang.String 无法转换为 java.lang.Double
【发布时间】:2023-01-22 08:48:49
【问题描述】:
我正在添加这个我收到此错误的最小代码
firestore()
.collection('someCollection')
.doc('someDocument')
.set({
test: 5,
})
.catch(e => {
alert(e);
});
Firestore 版本:"@react-native-firebase/firestore": "^14.7.0",
当我对文档使用 {test : 'something'} 时,我没有收到任何错误。
为什么会这样?我想在测试中存储整数值
【问题讨论】:
标签:
firebase
react-native
google-cloud-firestore
【解决方案1】:
look at breaking changes for v14
您需要检查您的“where/in”子句。
可能,以前你可能有这样的
.where('time' > user.registerTime.toDate().getTime())
但现在它抛出异常。
为了让它 tmp 工作,你可以这样写
.where('time' > ${user.registerTime.toDate().getTime()})
它不会抛出异常,但 idk 是否正确
(可能,最好的解决方案是在 firestore 服务器端执行迁移,因为他们提到要摆脱这个丑陋的 tmp 修复)