Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

this.ref.orderBy is not a function in index.esm.js #205

Open
KnightRag opened this issue Apr 21, 2021 · 0 comments
Open

this.ref.orderBy is not a function in index.esm.js #205

KnightRag opened this issue Apr 21, 2021 · 0 comments

Comments

@KnightRag
Copy link

KnightRag commented Apr 21, 2021

Hi,

I'm currently getting the following error:

ERROR TypeError: this.ref.orderBy is not a function
    queryPoint index.esm.js:1502
    queries index.esm.js:1460
    within index.esm.js:1459
    getNearbyDiscounts distance.service.ts:91

This occurs only when we pass a reference in the query method of the geo client:

const discountsRef = this.angularFirestore.collection('discounts');

this.geoClient.query("discounts").within(this.centerPoint, radius, Constants.dctPoint); // Works like this. But won't if passing discountRef => this.ref.orderBy is not a function

I thought in the beginning it occurred because the query Ref I was passing to geoClient.query() had already orderBy set, but the error still occurs after removing it.

I need to pass a ref because I have dynamic compound queries to be added on the ref.

I tried to understand the error but it feels there's an issue with the code itself at the following line.

GeoFireQuery.prototype.queryPoint = function (geohash, field) {
        var end = geohash + '~';
        return this.ref
            .orderBy(field + ".geohash")
            .startAt(geohash)
            .endAt(end);
    };

Can anyone help me or advise me for a workaround please?
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant