Comments (11)
I don't think this is a Geofirestore question as much as this is a Firebase Functions question. Either way, I'd tell you to do more research and reading the docs of firebase functions, because you dont need to import * as firebase from 'firebase';
And if you need to create a collectionref for geofirestore you could do...
import * as admin from 'firebase-admin';
const collectionRef = admin.firestore().collection('collection');
from geofirestore-js.
I know that admin is the normal way to query collections un cloud functions however if you try to assign that collectionRef to a new Geofirestore(collectionRef), you will get a casting error as Geofirestore "firebase.firestore.CollectionReference", firebase-admin's collection type "FirebaseFirestore.CollectionReference", In another thread @invention7 sugested to import firebase package instead of admin, but as I show you before even importing Geofirestore as its simplest way throws that error at build.
from geofirestore-js.
I agree with @stubborncoder that firebase-admin's 'collection' type appears to be incompatible with the collection type expected by the geofirestore constructor. To get around this, I created by collectionRef with the 'firebase' library.
Maybe, @MichaelSolati , there is an opportunity for Geofirestore in expanding the constructor to allow the firebase-admin's collection... but in terms of David's immediate need, I think it can be handled as-s.
@stubborncoder, in your firebase config, have you disabled persistence?
e.g.
PersistenceEnabled: false
?
from geofirestore-js.
Hi @invention7 my firebaseconfig wasn't modified at all, it's just as it's created by the firebase CLI... thanks for your help!, Edited: don't really know if this setting comes as false or true by default...
from geofirestore-js.
I'd be open to a PR if anyone wants to expand the types allowed. I'd also ask that the PR is made towards the dev
branch.
from geofirestore-js.
Hey @stubborncoder, sorry I missed your comment... try downgrading firebase to '5.0.0' (ie 'npm install [email protected]')
from geofirestore-js.
In general I can probably double type everything (it would just take a while to get through). You should also be able to // @ts-ignore
type issues for now. While it's not the end all be all solution, it should work until I dual type everything.
from geofirestore-js.
@invention7 that did the trick m8, I downgraded as you suggested and now it builds and runs without any further issues!. Thank you very much!.
from geofirestore-js.
np @stubborncoder ! Good luck!!
from geofirestore-js.
oh wow! awesome @MichaelSolati !
from geofirestore-js.
Thank you @invention7 !
For everyone else, Firebase Functions should work (may need to make a small patch, but for the most part it's good to go). Try npm i [email protected]
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.