I am writing cloud function in TypeScript, and trying to get Map object - AKA (nested objects, called maps) from firebase so I would be able to iterate through it.
This is the structure in my Firebase:
And I am trying to get the data like:
const tokenSettingsRef = db.collection('tokenSettings').doc('spread')
transaction.get(tokenSettingsRef).then((tokenSettingsDocSnapshot) => {
const tokenData = tokenSettingsDocSnapshot.data()
if (typeof tokenData !== 'undefined') {
console.log("tokennne3: " + tokenData.tokens[0])
console.log("tokennne4: " + tokenData)
console.log("tokennne5: " + tokenData.tokens)
console.log("tokennne1: " + tokenData.tokens.length())
console.log("tokennne2: " + tokenData.tokens.keys())
const variations = new Map(Object.entries(tokenData.tokens));
console.log("tokennne5: " + variations.keys)
console.log("tokennne6: " + variations.values)
None of the above doesn't give me Map so I could use it... Or log it out.
I am getting data but all I can see is smtg like [object Object]
What am I missing here, I didn't have any issues with getting arrays or plain objects...
