@@ -136,7 +136,7 @@ export class FirestoreComponent {
136136 . then ( ( querySnapshot : firestore . QuerySnapshot ) => {
137137 querySnapshot . forEach ( doc => console . log ( `${ doc . id } => ${ JSON . stringify ( doc . data ( ) ) } ` ) ) ;
138138 } )
139- . catch ( err => console . log ( "Get failed, error" + err ) ) ;
139+ . catch ( err => console . log ( "Get failed, error: " + err ) ) ;
140140
141141 // examples from https://firebase.google.com/docs/firestore/query-data/get-data
142142 const docRef : firestore . DocumentReference = firebase . firestore ( ) . collection ( "cities" ) . doc ( "BJ" ) ;
@@ -239,7 +239,7 @@ export class FirestoreComponent {
239239 console . log ( `Relatively small Californian city: ${ doc . id } => ${ JSON . stringify ( doc . data ( ) ) } ` ) ;
240240 } ) ;
241241 } )
242- . catch ( err => console . log ( "Where-get failed, error" + err ) ) ;
242+ . catch ( err => console . log ( "Where-get failed, error: " + err ) ) ;
243243 }
244244
245245 public firestoreWhereOrderLimit ( ) : void {
@@ -255,7 +255,21 @@ export class FirestoreComponent {
255255 console . log ( `Large Californian city: ${ doc . id } => ${ JSON . stringify ( doc . data ( ) ) } ` ) ;
256256 } ) ;
257257 } )
258- . catch ( err => console . log ( "firestoreWhereOrderLimit failed, error" + err ) ) ;
258+ . catch ( err => console . log ( "firestoreWhereOrderLimit failed, error: " + err ) ) ;
259+ }
260+
261+ public firestoreWhereCityHasALake ( ) : void {
262+ const query : firestore . Query = firebase . firestore ( ) . collection ( "cities" )
263+ . where ( "landmarks" , "array-contains" , "lake" ) ;
264+
265+ query
266+ . get ( )
267+ . then ( ( querySnapshot : firestore . QuerySnapshot ) => {
268+ querySnapshot . forEach ( doc => {
269+ console . log ( `city with a lake: ${ doc . id } => ${ JSON . stringify ( doc . data ( ) ) } ` ) ;
270+ } ) ;
271+ } )
272+ . catch ( err => console . log ( "firestoreWhereCityHasALake failed, error: " + err ) ) ;
259273 }
260274
261275 public firestoreDelete ( ) : void {
@@ -264,7 +278,7 @@ export class FirestoreComponent {
264278 . then ( ( ) => {
265279 console . log ( "Woofie deleted" ) ;
266280 } )
267- . catch ( err => console . log ( "Delete failed, error" + err ) ) ;
281+ . catch ( err => console . log ( "Delete failed, error: " + err ) ) ;
268282 }
269283
270284 public doWebGetValueForCompanies ( ) : void {
0 commit comments