Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- senderid : this.buddy.senderId,
- receiverid: this.buddy.receiverId,
- message : msg,
- created: firebase.firestore.FieldValue.serverTimestamp()
- this.db.collection(this.collectionName.friendsCollection).doc(this.buddy.docid)
- .collection(this.collectionName.chatsCollection).orderBy('created')
- .onSnapshot(snapshot=> {
- skip.buddymessages = [];
- if(snapshot.empty)
- {
- console.log("First Chat");
- }
- else{
- console.log("size",snapshot.size)
- snapshot.docChanges.forEach(change => {
- if (change.type === 'added') {
- console.log('New : ', change.doc.data());
- }
- if (change.type === 'modified') {
- console.log('Modified : ', change.doc.data());
- }
- if (change.type === 'removed') {
- console.log('Removed : ', change.doc.data());
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement