我们有一个“本机”应用程序,该应用程序使用Firestore数据库检索一些信息。我们使用react-native-firebase
包:
"react-native-firebase": "^4.1.0",
我们有一个曾经可以使用的查询,并且在某些更新停止工作之后。对于时间戳类型的日期字段,它们在快照查询中返回null。
firestore
.collection("multiplayerrooms")
.doc(result.id)
.collection("playerAttempts")
.orderBy("completeTimeInSeconds")
.get()
.then((querySnapshot) => {
playerAttemptsLength = querySnapshot.size;
playerAttempts = querySnapshot.docs;
console.log("player attempts");
console.log(querySnapshot);
如果我在Firebase控制台中查看,则可以看到相关文档的值。
如果我将鼠标悬停在该字段上,则可以看到时间戳类型显示。我知道问题不在于解析值,因为我们在将该时间戳解析为日期格式之前就返回了null。
我发现它可能与Firebase设置值有关:timestampsInSnapshots
,但是将其设置为true或false没什么区别。
firestore.settings({ timestampsInSnapshots: false });
firestore
.collection("multiplayerrooms")
.doc(result.id)
...
有关为什么在查询快照数据中将时间戳字段值返回null的任何信息?