@@ -143,10 +143,9 @@ function numberIs64Bit(item: number) {
143
143
return item < - Math . pow ( 2 , 31 ) + 1 || item > Math . pow ( 2 , 31 ) - 1 ;
144
144
}
145
145
146
-
147
146
function serializeItems ( value ) {
148
147
if ( typeof value === 'string' ) {
149
- return java . lang . String . valueOf ( value ) ;
148
+ return value ;
150
149
}
151
150
152
151
if ( typeof value === 'number' ) {
@@ -204,7 +203,7 @@ function serializeItems(value) {
204
203
205
204
if ( value && typeof value === 'object' ) {
206
205
const keys = Object . keys ( value ) ;
207
- let dict = new java . util . HashMap ( ) ;
206
+ const dict = new java . util . HashMap ( ) ;
208
207
keys . forEach ( ( key ) => {
209
208
dict . put ( key , serializeItems ( value [ key ] ) ) ;
210
209
} ) ;
@@ -646,114 +645,90 @@ export class Query<T extends DocumentData = DocumentData> implements IQuery<T> {
646
645
if ( fieldPath instanceof FieldPath ) {
647
646
switch ( opStr ) {
648
647
case '!=' :
649
- query = this . native . whereNotEqualTo ( fieldPath . native , value ?. native || value ) ;
648
+ query = this . native . whereNotEqualTo ( fieldPath . native , serializeItems ( value ) ) ;
650
649
break ;
651
650
case '<' :
652
- query = this . native . whereLessThan ( fieldPath . native , value ?. native || value ) ;
651
+ query = this . native . whereLessThan ( fieldPath . native , serializeItems ( value ) ) ;
653
652
break ;
654
653
case '>' :
655
- query = this . native . whereGreaterThan ( fieldPath . native , value ?. native || value ) ;
654
+ query = this . native . whereGreaterThan ( fieldPath . native , serializeItems ( value ) ) ;
656
655
break ;
657
656
case '<=' :
658
- query = this . native . whereLessThanOrEqualTo ( fieldPath . native , value ?. native || value ) ;
657
+ query = this . native . whereLessThanOrEqualTo ( fieldPath . native , serializeItems ( value ) ) ;
659
658
break ;
660
659
case '>=' :
661
- query = this . native . whereGreaterThanOrEqualTo ( fieldPath . native , value ?. native || value ) ;
660
+ query = this . native . whereGreaterThanOrEqualTo ( fieldPath . native , serializeItems ( value ) ) ;
662
661
break ;
663
662
case '==' :
664
- query = this . native . whereEqualTo ( fieldPath . native , value ?. native || value ) ;
663
+ query = this . native . whereEqualTo ( fieldPath . native , serializeItems ( value ) ) ;
665
664
break ;
666
665
case 'array-contains' :
667
666
query = this . native . whereArrayContains (
668
667
fieldPath . native ,
669
- Array . isArray ( value ) ? value . map ( ( val ) => {
670
- return val ?. native || val ;
671
- } ) : value
668
+ serializeItems ( value )
672
669
) ;
673
670
break ;
674
671
case 'array-contains-any' :
675
672
query = this . native . whereArrayContainsAny (
676
673
fieldPath . native ,
677
- java . util . Arrays . asList (
678
- value . map ( ( val ) => {
679
- return val ?. native || val ;
680
- } )
681
- )
674
+ serializeItems ( value )
682
675
) ;
683
676
break ;
684
677
case 'in' :
685
678
query = this . native . whereIn (
686
679
fieldPath . native ,
687
- value . map ( ( val ) => {
688
- return val ?. native || val ;
689
- } )
680
+ serializeItems ( value )
690
681
) ;
691
682
break ;
692
683
case 'not-in' :
693
684
query = this . native . whereNotIn (
694
685
fieldPath . native ,
695
- java . util . Arrays . asList (
696
- value . map ( ( val ) => {
697
- return val ?. native || val ;
698
- } )
699
- )
686
+ serializeItems ( value )
700
687
) ;
701
688
break ;
702
689
}
703
690
} else {
704
691
switch ( opStr ) {
705
692
case '!=' :
706
- query = this . native . whereNotEqualTo ( fieldPath as any , value ?. native || value ) ;
693
+ query = this . native . whereNotEqualTo ( fieldPath as any , serializeItems ( value ) ) ;
707
694
break ;
708
695
case '<' :
709
- query = this . native . whereLessThan ( fieldPath as any , value ?. native || value ) ;
696
+ query = this . native . whereLessThan ( fieldPath as any , serializeItems ( value ) ) ;
710
697
break ;
711
698
case '>' :
712
- query = this . native . whereGreaterThan ( fieldPath as any , value ?. native || value ) ;
699
+ query = this . native . whereGreaterThan ( fieldPath as any , serializeItems ( value ) ) ;
713
700
break ;
714
701
case '<=' :
715
- query = this . native . whereLessThanOrEqualTo ( fieldPath as any , value ?. native || value ) ;
702
+ query = this . native . whereLessThanOrEqualTo ( fieldPath as any , serializeItems ( value ) ) ;
716
703
break ;
717
704
case '>=' :
718
- query = this . native . whereGreaterThanOrEqualTo ( fieldPath as any , value ?. native || value ) ;
705
+ query = this . native . whereGreaterThanOrEqualTo ( fieldPath as any , serializeItems ( value ) ) ;
719
706
break ;
720
707
case '==' :
721
- query = this . native . whereEqualTo ( fieldPath as any , value ?. native || value ) ;
708
+ query = this . native . whereEqualTo ( fieldPath as any , serializeItems ( value ) ) ;
722
709
break ;
723
710
case 'array-contains' :
724
711
query = this . native . whereArrayContains (
725
712
fieldPath as any ,
726
- Array . isArray ( value ) ? value . map ( ( val ) => {
727
- return val ?. native || val ;
728
- } ) : value
713
+ serializeItems ( value )
729
714
) ;
730
715
break ;
731
716
case 'array-contains-any' :
732
717
query = this . native . whereArrayContainsAny (
733
718
fieldPath as any ,
734
- java . util . Arrays . asList (
735
- value . map ( ( val ) => {
736
- return val ?. native || val ;
737
- } )
738
- )
719
+ serializeItems ( value )
739
720
) ;
740
721
break ;
741
722
case 'in' :
742
723
query = this . native . whereIn (
743
724
fieldPath as any ,
744
- value . map ( ( val ) => {
745
- return val ?. native || val ;
746
- } )
725
+ serializeItems ( value )
747
726
) ;
748
727
break ;
749
728
case 'not-in' :
750
729
query = this . native . whereNotIn (
751
730
fieldPath as any ,
752
- java . util . Arrays . asList (
753
- value . map ( ( val ) => {
754
- return val ?. native || val ;
755
- } )
756
- )
731
+ serializeItems ( value )
757
732
) ;
758
733
break ;
759
734
}
0 commit comments