@@ -797,27 +797,47 @@ describe("firestore", () => {
797
797
// [END array_contains_filter]
798
798
} ) ;
799
799
800
+ it ( "should handle an array contains any where" , ( ) => {
801
+ const citiesRef = db . collection ( 'cities' ) ;
802
+ // [START array_contains_any_filter]
803
+ citiesRef . where ( 'regions' , 'array-contains-any' ,
804
+ [ 'west_coast' , 'east_coast' ] ) ;
805
+ // [END array_contains_any_filter]
806
+ } ) ;
807
+
808
+ it ( "should handle an in where" , ( ) => {
809
+ const citiesRef = db . collection ( 'cities' ) ;
810
+ // [START in_filter]
811
+ citiesRef . where ( 'region' , 'in' , [ 'USA' , 'Japan' ] ) ;
812
+ // [END in_filter]
813
+
814
+ // [START in_filter_with_array]
815
+ citiesRef . where ( 'region' , 'in' ,
816
+ [ [ 'west_coast' , 'east_coast' ] ] ) ;
817
+ // [END in_filter_with_array]
818
+ } ) ;
819
+
800
820
it ( "should handle compound queries" , ( ) => {
801
821
var citiesRef = db . collection ( "cities" ) ;
802
822
// [START chain_filters]
803
- citiesRef . where ( "state" , "==" , "CO" ) . where ( "name" , "==" , "Denver" )
804
- citiesRef . where ( "state" , "==" , "CA" ) . where ( "population" , "<" , 1000000 )
823
+ citiesRef . where ( "state" , "==" , "CO" ) . where ( "name" , "==" , "Denver" ) ;
824
+ citiesRef . where ( "state" , "==" , "CA" ) . where ( "population" , "<" , 1000000 ) ;
805
825
// [END chain_filters]
806
826
} ) ;
807
827
808
828
it ( "should handle range filters on one field" , ( ) => {
809
829
var citiesRef = db . collection ( "cities" ) ;
810
830
// [START valid_range_filters]
811
- citiesRef . where ( "state" , ">=" , "CA" ) . where ( "state" , "<=" , "IN" )
812
- citiesRef . where ( "state" , "==" , "CA" ) . where ( "population" , ">" , 1000000 )
831
+ citiesRef . where ( "state" , ">=" , "CA" ) . where ( "state" , "<=" , "IN" ) ;
832
+ citiesRef . where ( "state" , "==" , "CA" ) . where ( "population" , ">" , 1000000 ) ;
813
833
// [END valid_range_filters]
814
834
} ) ;
815
835
816
836
it ( "should not handle range filters on multiple field" , ( ) => {
817
837
var citiesRef = db . collection ( "cities" ) ;
818
838
expect ( ( ) => {
819
839
// [START invalid_range_filters]
820
- citiesRef . where ( "state" , ">=" , "CA" ) . where ( "population" , ">" , 100000 )
840
+ citiesRef . where ( "state" , ">=" , "CA" ) . where ( "population" , ">" , 100000 ) ;
821
841
// [END invalid_range_filters]
822
842
} ) . to . throwException ( ) ;
823
843
} ) ;
0 commit comments