Skip to content

[Pagination / Compound query] Would it possible with Multiple Field Cursor Query? #119

@jackie-d

Description

@jackie-d

Hello, looking at a solution for pagination / compound query / ranged query.

I've found the following on the Firestore doc:
https://firebase.google.com/docs/firestore/query-data/query-cursors#set_cursor_based_on_multiple_fields

It says:

When using a cursor based on a field value (not a DocumentSnapshot), you can make the cursor position more precise by adding additional fields. This is particularly useful if your data set includes multiple documents that all have the same value for your cursor field, making the cursor's position ambiguous. You can add additional field values to your cursor to further specify the start or end point and reduce ambiguity.

Would it in any way helps to solve this problem?

For some tests I've tried to modify your library:

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

but I got duplicated query results.

Any idea? 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