Skip to content

Commit 8fef964

Browse files
author
Brian Chen
committed
clean conflictingOps comments
1 parent d914433 commit 8fef964

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

packages/firestore/src/api/database.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1709,37 +1709,35 @@ function validateDisjunctiveFilterElements(
17091709
/**
17101710
* Given an operator, returns the set of operators that cannot be used with it.
17111711
*
1712+
* Operators in a query must adhere to the following set of rules:
1713+
* 1. Only one array operator is allowed.
1714+
* 2. Only one disjunctive operator is allowed.
1715+
* 3. NOT_EQUAL cannot be used with another NOT_EQUAL operator.
1716+
* 4. NOT_IN cannot be used with array, disjunctive, or NOT_EQUAL operators.
1717+
*
17121718
* Array operators: ARRAY_CONTAINS, ARRAY_CONTAINS_ANY
17131719
* Disjunctive operators: IN, ARRAY_CONTAINS_ANY, NOT_IN
17141720
*/
17151721
function conflictingOps(op: Operator): Operator[] {
17161722
switch (op) {
17171723
case Operator.NOT_EQUAL:
1718-
// No other NOT_EQUAL or NOT_IN operator can be used with NOT_EQUAL.
17191724
return [Operator.NOT_EQUAL, Operator.NOT_IN];
17201725
case Operator.ARRAY_CONTAINS:
17211726
return [
1722-
// Only 1 ARRAY operator can be used.
17231727
Operator.ARRAY_CONTAINS,
17241728
Operator.ARRAY_CONTAINS_ANY,
1725-
// NOT_IN cannot be used with any array operators.
17261729
Operator.NOT_IN
17271730
];
17281731
case Operator.IN:
1729-
// Only one disjunctive operator can be used.
17301732
return [Operator.ARRAY_CONTAINS_ANY, Operator.IN, Operator.NOT_IN];
17311733
case Operator.ARRAY_CONTAINS_ANY:
17321734
return [
1733-
// Only one ARRAY operator can be used.
17341735
Operator.ARRAY_CONTAINS,
1735-
// Only one disjunctive operator can be used.
17361736
Operator.ARRAY_CONTAINS_ANY,
17371737
Operator.IN,
17381738
Operator.NOT_IN
17391739
];
17401740
case Operator.NOT_IN:
1741-
// NOT_IN cannot be used with another array, disjunctive, or NOT_EQUAL
1742-
// operator.
17431741
return [
17441742
Operator.ARRAY_CONTAINS,
17451743
Operator.ARRAY_CONTAINS_ANY,

0 commit comments

Comments
 (0)