I'm trying to retrieve all the documents inside a collection, but I get an error in return: Uncaught (in promise) TypeError: snapshot.data is not a function.
Code:
var imgRef = db.collection('posts').doc(uid).collection('userPosts');
imgRef.get().then(function(snapshot) {
const data = snapshot.data()
console.log(data)
if (data) {
const picURL = data.picURL
console.log(picURL)
var img = document.querySelector(".img")
img.src = picURL
} else {
console.log("PicURL doesn't exist")
}