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

Update outdated error message to include '!=' #4262

Merged
merged 3 commits into from
Jan 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/metal-paws-joke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@firebase/firestore': minor
---

Updated an outdated error message to include '!=' and 'not-in' as an inequalities.
4 changes: 2 additions & 2 deletions packages/firestore/src/lite/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ function validateNewFilter(query: InternalQuery, filter: Filter): void {
throw new FirestoreError(
Code.INVALID_ARGUMENT,
'Invalid query. All where filters with an inequality' +
' (<, <=, >, or >=) must be on the same field. But you have' +
' (<, <=, !=, not-in, >, or >=) must be on the same field. But you have' +
` inequality filters on '${existingField.toString()}'` +
` and '${filter.field.toString()}'`
);
Expand Down Expand Up @@ -845,7 +845,7 @@ function validateOrderByAndInequalityMatch(
throw new FirestoreError(
Code.INVALID_ARGUMENT,
`Invalid query. You have a where filter with an inequality ` +
`(<, <=, >, or >=) on field '${inequality.toString()}' ` +
`(<, <=, !=, not-in, >, or >=) on field '${inequality.toString()}' ` +
`and so you must also use '${inequality.toString()}' ` +
`as your first argument to orderBy(), but your first orderBy() ` +
`is on field '${orderBy.toString()}' instead.`
Expand Down
8 changes: 4 additions & 4 deletions packages/firestore/test/integration/api/validation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ apiDescribe('Validation:', (persistence: boolean) => {
collection.where('x', '>=', 32).where('y', '<', 'cat')
).to.throw(
'Invalid query. All where filters with an ' +
'inequality (<, <=, >, or >=) must be on the same field.' +
'inequality (<, <=, !=, not-in, >, or >=) must be on the same field.' +
` But you have inequality filters on 'x' and 'y'`
);
});
Expand All @@ -818,7 +818,7 @@ apiDescribe('Validation:', (persistence: boolean) => {
collection.where('y', '>', 32).where('x', '!=', 33)
).to.throw(
'Invalid query. All where filters with an ' +
'inequality (<, <=, >, or >=) must be on the same field.' +
'inequality (<, <=, !=, not-in, >, or >=) must be on the same field.' +
` But you have inequality filters on 'y' and 'x`
);
}
Expand All @@ -833,7 +833,7 @@ apiDescribe('Validation:', (persistence: boolean) => {
collection.where('y', '>', 32).where('x', 'not-in', [33])
).to.throw(
'Invalid query. All where filters with an ' +
'inequality (<, <=, >, or >=) must be on the same field.' +
'inequality (<, <=, !=, not-in, >, or >=) must be on the same field.' +
` But you have inequality filters on 'y' and 'x`
);
}
Expand All @@ -846,7 +846,7 @@ apiDescribe('Validation:', (persistence: boolean) => {
const collection = db.collection('test');
const reason =
`Invalid query. You have a where filter with an ` +
`inequality (<, <=, >, or >=) on field 'x' and so you must also ` +
`inequality (<, <=, !=, not-in, >, or >=) on field 'x' and so you must also ` +
`use 'x' as your first argument to Query.orderBy(), but your first ` +
`orderBy() is on field 'y' instead.`;
expect(() => collection.where('x', '>', 32).orderBy('y')).to.throw(
Expand Down