So in firebase 8 , it is possible to do
const songRef = await songCollection.add(song);
and then
const screenShot = await songRef.get()
However firebase 9 uses the addDoc() method to create a document , so I can add document like
const songRef = await addDoc(songsCollection, song);
but geting songRef.get() is not a function . So how do I get the document snapshot I just created?
CodePudding user response:
songRef
should contain an id
, which you can use to get the document with like so: getDoc(songRef.id)