Search code examples
node.jsgeofirestore

Cannot initiate GeoFirestore instance in node.js application


I use GeoFirestore in my node.js application. In the first lines of the document i have:

var GeoFirestore = require("geofirestore");

And then i use the code

const geoFirestore = new GeoFirestore(collectionRef);

With the collectionRef being a valid ref to the my firestore collection.

The issue is that i get the error

"TypeError: GeoFirestore is not a constructor"

What is the problem here? Thanks for any help.


Solution

  • The index.js of geofirestore exports a few different files, so I can say your import wouldn't work. I believe you would want to do this (if you're not using Typescript or an ES6+):

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

    Let me know if that works for you.