Node Js 新手,希望这非常简单!
在带有 Firestore 的 Node JS 中,我想访问“显示名称”:James,“年龄”:22
年龄没有空间,所以我可以输入
const newValue = doc.data();
const age = newValue.Age;
但显示名称包含空格 怎么输入这个?
const displayName = newValue.displayName;
最佳答案
您需要使用 []
表示法来获取该属性。
所以:
const displayName = newValue["display name"];
关于javascript - Node Js Firestore 使用空格访问数据库值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50743471/