This repository was archived by the owner on Apr 4, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -123,12 +123,7 @@ export class ItemsComponent {
123123 const collectionRef : firestore . CollectionReference = firebase . firestore ( ) . collection ( "dogs" ) ;
124124 collectionRef . get ( )
125125 . then ( ( querySnapshot : firestore . QuerySnapshot ) => {
126- querySnapshot . forEach ( doc => {
127- console . log ( `${ doc . id } => ${ JSON . stringify ( doc . data ( ) ) } ` ) ;
128- // since there's a reference stored here, we can use that to retrieve its data
129- const docRef : firestore . DocumentReference = doc . data ( ) . ref2sf ;
130- docRef . get ( ) . then ( res => console . log ( "docref.get: " + JSON . stringify ( res . data ( ) ) ) ) ;
131- } ) ;
126+ querySnapshot . forEach ( doc => console . log ( `${ doc . id } => ${ JSON . stringify ( doc . data ( ) ) } ` ) ) ;
132127 } )
133128 . catch ( err => console . log ( "Get failed, error" + err ) ) ;
134129
@@ -138,6 +133,9 @@ export class ItemsComponent {
138133 docRef . get ( ) . then ( ( doc : firestore . DocumentSnapshot ) => {
139134 if ( doc . exists ) {
140135 console . log ( "Document data:" , JSON . stringify ( doc . data ( ) ) ) ;
136+ // since there's a reference stored here, we can use that to retrieve its data
137+ const docRef : firestore . DocumentReference = doc . data ( ) . referenceToCitiesDC ;
138+ docRef . get ( ) . then ( res => console . log ( "docref.get: " + JSON . stringify ( res . data ( ) ) ) ) ;
141139 } else {
142140 console . log ( "No such document!" ) ;
143141 }
You can’t perform that action at this time.
0 commit comments