Search
 
SCRIPT & CODE EXAMPLE
 

TYPESCRIPT

how to update firebase document field angular

updateDoc(_id: string, _value: string) {
  let doc = this.afs.collection('options', ref => ref.where('id', '==', _id));
  doc.snapshotChanges().pipe(
    map(actions => actions.map(a => {                                                      
      const data = a.payload.doc.data();
      const id = a.payload.doc.id;
      return { id, ...data };
    }))).subscribe((_doc: any) => {
     let id = _doc[0].payload.doc.id; //first result of query [0]
     this.afs.doc(`options/${id}`).update({rating: _value});
    })
}
Comment

PREVIOUS NEXT
Code Example
Typescript :: React Draft Wysiwyg typescript 
Typescript :: spade operator typescript 
Typescript :: rstudio plots arrows(), text() 
Typescript :: hashMap.put("name", fruits Names[i]); 
Typescript :: how to check if a field exists in a dictionry or not 
Typescript :: Date minus date typescript 
Typescript :: expected assets to be a list in flutter 
Typescript :: nodejs encryption 128bit 
Typescript :: config all requests to one page nginx 
Typescript :: les différents types de cours 
Typescript :: how to select a column with brackets in jupyter notebook 
Typescript :: for loop of unlimited inputs python 
Typescript :: Make ngModel wait for data angular 
Typescript :: how can i get 2 inputs in singal line seprated by space 
Typescript :: cluster on lists of values that start with a certain value 
Typescript :: aws lambda cache gets to next response 
Typescript :: checked a element is focused with its key pressed 
Typescript :: powershell check if the sql server ports are dynamic 
Typescript :: ts Template pattern 
Typescript :: typescript dictionary usestate 
Typescript :: convert java to typescript 
Typescript :: check if element exists in array java 
Typescript :: INTENT 
Typescript :: Line 23:12: img elements must have an alt prop, either with meaningful text, or an empty string for decorative images 
Typescript :: typescript find in all words 
Cpp :: how to disable buttons in unity 
Cpp :: how to print a string to console in c++ 
Cpp :: how to sort a vector in reverse c++ 
Cpp :: Count set bits in an integer c++ 
Cpp :: priority queue ordered by second element 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =