1const database = firebase.firestore(); 2 3const db = { 4 5 Get : async function(collection,document){ 6 const docRef = database.collection(collection).doc(document); 7 return docRef.get().then(function(doc) { 8 if (doc.exists) { 9 return doc.data(); 10 } else { 11 return null; 12 } 13 }).catch(function(error) { 14 console.log(error); 15 return null; 16 }); 17 }, 18 19 Find : async function(collection,field,value){ 20 const ref = database.collection(collection).where(field, '==', value); 21 const snapshot = await ref.get(); 22 const docs = []; 23 snapshot.forEach((doc) => { 24 const data = doc.data(); 25 data.id = doc.id; 26 docs.push(data); 27 }); 28 return docs; 29 }, 30 31 Update : async function(collection,document,data){ 32 return database.collection(collection).doc(document).update(data); 33 } 34 35} 36
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.