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

fix(firestore): fix an issue where using FieldPath in orderBy would lead to a native error being thrown #6814

Merged
merged 12 commits into from
Jan 10, 2023
18 changes: 18 additions & 0 deletions packages/firestore/e2e/Query/where.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,24 @@ describe('firestore().collection().where()', function () {
});
});

it('returns with when combining greather than and lesser than on the same nested field', async function () {
Lyokone marked this conversation as resolved.
Show resolved Hide resolved
const colRef = firebase.firestore().collection(`${COLLECTION}/filter/greaterandless`);

await Promise.all([
colRef.add({ nested: { field: 0 } }),
colRef.add({ nested: { field: 1 } }),
colRef.add({ nested: { field: 2 } }),
colRef.add({ nested: { field: 3 } }),
]);

const snapshot = await colRef
.where(new firestore.FieldPath('nested.field'), '>=', 1)
mikehardy marked this conversation as resolved.
Show resolved Hide resolved
.where(new firestore.FieldPath('nested.field'), '<=', 2)
.orderBy(new firestore.FieldPath('nested.field'));

snapshot.size.should.eql(2);
});

it('returns with where array-contains filter', async function () {
const colRef = firebase.firestore().collection(`${COLLECTION}/filter/array-contains`);

Expand Down