Nuxt和Firestore:无法按日期查询

时间:2019-04-11 17:05:09

标签: firebase google-cloud-firestore nuxt.js

我正在尝试在通用应用中使用Nuxt从Firestore中按日期查询数据:

asyncData() {
    citiesRef
      .where("date", ">", new Date())
      .get()
      .then(() => {
        console.log("ok");
      })
    return {};
  }

但是从服务器端加载时出现错误(在客户端未发生):

  

使用无效数据调用的函数Query.where()。不支持的字段   值:一个自定义的Date对象

与类似的错误:

asyncData() {
    citiesRef
      .add({
        name: "Tokyo"
      })
      .then(function(docRef) {
        console.log("Document written with ID: ", docRef.id);
      });
    return {};
  }
  

Function CollectionReference.add()要求其第一个参数为   对象类型,但它是:一个自定义对象对象

这似乎不是firebase错误,因为我无法在简单的节点env上重现此错误:https://github.com/ThomasKientz/firestore-node-repro

Nuxt复制:https://github.com/ThomasKientz/nuxt-firestore-repro

有什么想法吗?

0 个答案:

没有答案