const sub1 = this.angularFirestore.collection('Date').doc('username).collection('time').snapshotChanges(); const sub2 = await sub1.subscribe((snapData: DocumentChangeAction<any>[]) => { ` // After each minute, new data is inserted in firebase storage, and the below // code runs automatically, because I have subscribed to it. // now the problem is, after 1 minute, snapData has duplicate records // and for loop is also executed. // method for getting URL from firebase storage, called from below for loop` const send = storageRef => new Promise(resolve => { storageRef.getDownloadURL().then(url => { resolve(url); }, err => { } ); } ); for (const d of snapData) { const storageRef = firebase.storage().ref().child(d.payload.doc.data().timeEachMinute); const ImgUrl = await send(storageRef); this.timestampsList.push({ dateObj: d.payload.doc.data().dateObj, imageUrl: ImgUrl, date: d.payload.doc.data().screenShot, name: d.payload.doc.data().user }); } } sub2.unsubscribe();Por ejemplo, estoy recuperando 1000 registros, que pueden no completarse en un minuto, supongamos que se recuperan 500 registros, después de un minuto, los nuevos registros comienzan a recuperarse desde el inicio y 501 en adelante, lo que conduce a registros duplicados. Ahora estoy confundido si el problema está en el bucle for o en la suscripción del observador.