Comments (6)
I'm assuming you're testing version 3 of the library. With that in mind I don't believe your import syntax for for firebase is correct. Also you need to instantiate a firestore object, which I don't see.
I see some similarities in what you have to the sample I have in the readme, please give it another look though https://github.com/geofirestore/geofirestore-js/blob/v3.0.0/README.md#documentation
And if you have any questions let me know. I'll keep the issue open till Sunday so you can let me know if that works.
from geofirestore-js.
I updated the code, basically I have the part of the code of initialising app and firestore in a separate file.
from geofirestore-js.
@razbakov what version are you using? (And would you possibly be cool with making sample of on something like https://codepen.io/ ??)
from geofirestore-js.
My versions are:
"firebase": "^5.6.0",
"geofirestore": "^2.2.3",
from geofirestore-js.
Here is example - https://codesandbox.io/s/y04wj6zpoj
from geofirestore-js.
Ok! This I can easily address. I think you may have been referencing the documentation for version 3 which is located on geofirestore.com, however you're using version 2.x.x
Check out the docs for version 2
And as an example on how to do what you wanted to do...
import * as firebase from 'firebase/app';
import 'firebase/firestore';
import { GeoFirestore } from 'geofirestore'
// Initialize the Firebase SDK
firebase.initializeApp({
// ...
});
// Array to store events
let events = [];
// Create a Firestore collection reference
const collection = firebase.firestore().collection('events');
// Create a GeoFirestore reference
const geofirestore = new GeoFirestore(collection);
// Create a GeoQuery based on a location
const query = geofirestore.query({ center: new firebase.firestore.GeoPoint(48.1077212, 11.6019103), radius: 50 })
// Listener for docs as they come in
query.on('key_entered', ($key, result) => {
result.$key = $key;
events.push(result);
});
// Listener for docs as they exit
query.on('key_exited', ($key) => {
events = events.filter((event) => event.$key !== $key));
});
IF however you want to use version 3.0.0 (as your current code shows), you can install it like this:
npm i geofirestore/geofirestore-js#v3.0.0
It's still in kind of a beta state, however it's almost good to go, and I feel comfortable saying you could/should try it. I'm just writing tests to validate it works, otherwise the development is pretty much done (unless a test tells me I screwed up)
from geofirestore-js.
Related Issues (20)
- Paginating data after fetched HOT 1
- Question - how can I find near documents with each unique radius? HOT 11
- How to write to firestore after geofirestore query HOT 1
- can't write to firestore properly after geofirestore query HOT 1
- StartAt or startAfter support HOT 1
- Query speed HOT 6
- Custom document key HOT 1
- Geoqueries with additional queries? HOT 3
- When querying `near`: `distance` prop is missing when distance is 0 HOT 1
- Support for Firebase JS SDK 9 HOT 9
- customKey not working on read HOT 10
- Pass a custom document ID HOT 1
- Query returning zero results when filtering with where HOT 8
- Support for new firestore 9.x? HOT 1
- runTransaction on a collection (server-side using cloud functions) HOT 1
- firebase geofirestore v9 not working HOT 1
- Bug double removed on a marker HOT 1
- Geofirestore and onSnapshot are giving delayed events - information is not updating properly
- Unsubscribe from GeoQuery.onSnapshot on document deletion HOT 1
- Typescript errors when trying to deploy function HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geofirestore-js.