geofirex icon indicating copy to clipboard operation
geofirex copied to clipboard

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

Open jackie-d opened this issue 4 years ago • 0 comments

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.

jackie-d avatar Apr 15 '20 08:04 jackie-d