【问题标题】:Cannot initiate GeoFirestore instance in node.js application无法在 node.js 应用程序中启动 GeoFirestore 实例
【发布时间】:2018-12-18 23:33:57
【问题描述】:

我在我的 node.js 应用程序中使用 GeoFirestore。在文件的第一行我有:

var GeoFirestore = require("geofirestore");

然后我使用代码

const geoFirestore = new GeoFirestore(collectionRef);

collectionRef 是 my firestore 集合的有效引用。

问题是我得到了错误

“TypeError:GeoFirestore 不是构造函数”

这里有什么问题?感谢您的帮助。

【问题讨论】:

    标签: node.js geofirestore


    【解决方案1】:

    geofirestore 的index.js 导出了几个不同的文件,所以我可以说你的导入不起作用。我相信你会想要这样做(如果你不使用 Typescript 或 ES6+):

    var GeoFirestore = require("geofirestore").GeoFirestore;
    

    让我知道这是否适合你。

    【讨论】:

      猜你喜欢
      • 2017-10-07
      • 2013-01-20
      • 2021-12-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多