How to initialize GeoFire for Firestore Client Side?

146 Views Asked by At

I'm looking to run GeoQueries client side in my app to query my Firestore DB and have reviewed the documentation here:

https://firebase.google.com/docs/firestore/solutions/geoqueries

However, it doesn't mention how to do this client side or how to initialize it. So I looked around I tried the following:

Adding a static .js file from the gitHub repo

<script src="/geofire-common.min.js></script>

And I get an error message that geofire is not defined.

I also tried using this link:

<script src="https://my-firebase-project.web.app/geofire-5.0.1.min.js"></script>

And still got the same error.

Can anyone point me in the right direction to get geoqueries for firestore client-side?

Thank you,

1

There are 1 best solutions below

0
Cliff Coulter On

Putting

const geofire = require("geofire-common");

at the top of the code file where the queries are used works for me.