更新时间:2023-11-29 07:55:22
将值写入Firebase数据库时,会自动在其中创建键和路径.因此,要生成路径info/important/personal
,您需要在其下写一个值.例如:
Keys and paths in the Firebase Database are automatically created when you write a value to them. So to generate the path info/important/personal
, you would write a value under it. For example:
firebase.database().ref('info/important/personal').set(true);
这将生成以下JSON:
This will generate the following JSON:
{
"info": {
"important": {
"personal": true
}
}
}
请注意,相反情况也是如此:Firebase会自动删除空键/路径.因此,如果您删除上面的true
,则整个JSON将被删除.
Note that the inverse is also true: Firebase will automatically remove empty keys/paths. So if you delete the true
above, the entire JSON will be deleted.