I was having a good time using Firestore but I'm now starting to think that using this product may be impractical as I am having a lot of challenges trying to query my data.
Ultimately, I am trying to to retrieve a list of geographical locations from a Firestore document by providing some filtration criteria (price range, date ranges, geographical bounds). Unfortunately, Firestore does not yet support multi range queries nor do they support geographical queries. Below are some things I have tried so far. I am using AngularFire2 for this implementation:
This works
@Effect() loadPostings: Observable<Action> = this.actions
.ofType<LoadPostings>(MapActionTypes.Load_Postings)
.switchMap(
latLngBound => this.firestoreDB.collection<Posting>('postings', ref => ref
.where('duration.min', '>=', 1) // --------> this works
).valueChanges()
.map(postings => new LoadPostingsSuccess(postings))
);
This works as well
@Effect() loadPostings: Observable<Action> = this.actions
.ofType<LoadPostings>(MapActionTypes.Load_Postings)
.switchMap(
latLngBound => this.firestoreDB.collection<Posting>('postings', ref => ref
.where('duration.max', '<=', 5) // ------> this works as well
).valueChanges()
.map(postings => new LoadPostingsSuccess(postings))
);
This Doesnt not work (for some reason)
@Effect() loadPostings: Observable<Action> = this.actions
.ofType<LoadPostings>(MapActionTypes.Load_Postings)
.switchMap(
latLngBound => this.firestoreDB.collection<Posting>('postings', ref => ref
.where('duration.min', '>=', 1) // ---> 2 range queries dont work :(
.where('duration.max', '<=', 5)
).valueChanges()
.map(postings => new LoadPostingsSuccess(postings))
);
These limitations do not come off as a surprise as the documentation explicitly says that this cannot be done. But how is this even offering? It seems like I'm trying to do a pretty basic query, am I wrong? How do I go about this? Should I abandon this and just make my own backend?