Database 在Firebase中命名数据库子项?

Database 在Firebase中命名数据库子项?,database,naming,firebase,Database,Naming,Firebase,这是我的密码 function saveTrip() { routeData.clear(); for (var i = 0; i < dirDisplay.directions.routes[0].legs.length; i++) { for (var j = 0; j < dirDisplay.directions.routes[0].legs[i].steps.length; j++) { routeData.push(dirDisplay.directions.routes

这是我的密码

function saveTrip()
{
routeData.clear();
for (var i = 0; i < dirDisplay.directions.routes[0].legs.length; i++) {
for (var j = 0; j < dirDisplay.directions.routes[0].legs[i].steps.length; j++) {
routeData.push(dirDisplay.directions.routes[0].legs[i].steps[j].path);
}
}
routeLinesRef.push(routeData, function(error){
if (error) {
$('#savedSpan').html('Data could not be saved.' + error);
} else {
$('#savedSpan').html('Data saved successfully!');
}
});
}

Array.prototype.clear = function() {
this.splice(0, this.length);
};

routeLinesRef.limit(10).on('child_added', function(snapshot)
{
// loop over each route we get from firebase
route = snapshot.val();

我该怎么办?我找不到任何教程或任何东西。

你想写什么?
路线坐标
?您可以只使用
projectfootprintsref.child(“-J6fPsh…”).set(whateverData)
?我正在尝试从html用户输入中保存“child”吗?谢谢你的调查。
id = snapshot.name();
// make an array that is initially blank
// It will contain all the latitude and longitudes of each point on in the route
var routeCoordinates = [];
// This loops over each point on the route
for (var i=0; i<route.length; i++)
{

for (var j in route[i])
{
if (j==0 && i>0)
{
continue
}
else
{
if (route[i][j].lb && route[i][j].mb) {
routeCoordinates.push(new google.maps.LatLng
(route[i][j].lb, route[i][j].mb));
//console.log(j + ' ' + snapshot.val()[route][i][j].lb, snapshot.val()[route][i][j].mb);
}
}
}
}