Skip to content

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

@KnightRag

Description

@KnightRag

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions