Firebase查询快照为时间戳字段返回null而不是任何值

时间:2020-06-06 20:20:15

标签: javascript firebase react-native google-cloud-firestore react-native-firebase

我们有一个“本机”应用程序,该应用程序使用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);

enter image description here 如上所示,这是针对dateComplete字段值的。

如果我在Firebase控制台中查看,则可以看到相关文档的值。
enter image description here

如果我将鼠标悬停在该字段上,则可以看到时间戳类型显示。我知道问题不在于解析值,因为我们在将该时间戳解析为日期格式之前就返回了null。

我发现它可能与Firebase设置值有关:timestampsInSnapshots,但是将其设置为true或false没什么区别。

firestore.settings({ timestampsInSnapshots: false });
            firestore
              .collection("multiplayerrooms")
              .doc(result.id)
...

有关为什么在查询快照数据中将时间戳字段值返回null的任何信息?

0 个答案:

没有答案