I'm trying to build a tracking driver app using firebase.
I've retrieved all driver data correctly and I make on everyone a marker but I have to know how can I deleted if one of the drivers changes his position to Update it.
My code in Js:
var n=0;
var leadsRef = database.ref('Tracking');
leadsRef.on('value', function(snapshot) {
    snapshot.forEach(function(childSnapshot) {
      var childData = childSnapshot.val();
      console.log(" tracking The updated Chauffeur nb " +n +" " + childData.email);
      console.log(" tracking The updated Chauffeur nb " +n+ " "+ childData.latitude);
      console.log(" tracking The updated Chauffeur nb " +n+ " "+ childData.longitude);
      L.marker([parseFloat(childData.latitude), parseFloat(childData.longitude)], {icon: greenIcon}).addTo(mymap).bindPopup("I am nb "+childData.email+" hi");
    n++;
    });
});
 
     
     
    