This is because by using valueChanges()
"all Snapshot metadata is stripped and just the method provides only the data", as explained in the doc.
You should use snapshotChanges()
, see the doc here which says: "Why would you use it? - When you need a list of data but also want to keep around metadata."