Created
November 22, 2019 17:56
-
-
Save BradCoffield/e8437f00cd958503029ec00f68872240 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function getValues(theCollection) { | |
console.log("start"); | |
var result; | |
return db //note this return________ | |
.collection(theCollection) | |
.get() | |
.then(snapshot => { | |
let theData = []; | |
snapshot.forEach(doc => { | |
theData.push({ [doc.id]: doc.data() }); | |
}); | |
result = theData; | |
console.log("HERE WE BE"); | |
return result; //note this return__________ | |
}) | |
.catch(err => { | |
console.log("Error getting documents", err); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let dataAccess = require("../db"); | |
(async () => { | |
try { | |
let rez = await dataAccess.getFirestoreCollection(theCollection); | |
res.send(rez); | |
} catch (err) { | |
console.log("ERROR:", err); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment