Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let userRef2 = firebase.firestore().collection("users").doc(participantID);
- const result2 = await firebase.firestore().collection("recommendedVideo").where("user", "==", userRef2).get();
- alert("3 "+result2.size);
- await Promise.all(result2.map(async doc2 => {
- alert(doc2);
- //3 - Get video ref to compate to Array
- const videoFef = doc2.data().video.id;
- alert("videoFef "+videoFef);
- const doc3 = await firebase.firestore().collection("videos").doc(videoFef).get();
- if (!doc3.exists) {
- alert("Não exisste doc videos");
- return;
- }
- var sequence = doc3.data().sequenceNumberID;
- for (var i = 0; i < newRec.length; i++) {
- alert("5 ");
- if (String(sequence) !== String(newRec[i])) return;
- var index = newRec.indexOf(newRec[i]);
- if (index > -1) newRec.splice(index, 1);
- }
- })).catch(function (error) {
- alert(error);
- })
- // end of Promise.all
- insertData(newRec);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement