error in retrieving the last document in firebase cloud firestore db
Clash Royale CLAN TAG #URR8PPP error in retrieving the last document in firebase cloud firestore db I'm trying to get the last document from my collection using orderBy method and limit(1) everything is Ok and works as expected , but the problem is when I added a new document to my collection from somewhere else such as firebase console while opening the same page in my app I got the last 2 documents although I specified limit(1) . When I refresh the page everything goes well . how could I solve this problem ? Thanks in advance . -- Here is some of my code : first get my chats ordered descending , then get friend's details from chatUsers collection , finally get the last message document . chat-provider.ts getChats() { return this.afs.collection(`chatUsers/${this.userId}/chats` , ref => ref.orderBy('updatedAt' , 'desc')).valueChanges() } getlastMessage(friendId : string) { return this.afs.collection(`chatUsers/${this.userId}/chats/${friendId}/message...