title: How to get all markers on Leaflet
body: <p>I have a listener that will detect changes of the location of objects on databases. It will pass all the information of the object that is being changed. </p>
  
  <p>I want to get all markers from the current map and find the marker that is affected. Once found, update the location. </p>
  
  <p>But, I am still looking for the best ways to get all markers from the map and then I can update the location. </p>
  
  <pre><code>var map = L.map('map').setView([37.78541,-122.40787], 13);
  var markers = new L.FeatureGroup();
  var mapLink =
      '&lt;a href="http://openstreetmap.org"&gt;OpenStreetMap&lt;/a&gt;';
  L.tileLayer(
      'https://{s}.tiles.mapbox.com/v4/examples.map-i87786ca/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoiZ2Vja29iIiwiYSI6IndzVjRGN0kifQ.lToORsjE0lkt-VQ2SXOb-Q', {
          attribution: '&amp;copy; ' + mapLink + ' Contributors',
          maxZoom: 18,
      }).addTo(map);
  
  var marker = createCircleMarker([44.977368, -93.232659]);
  marker._id = "69"; // Id of the marker
  map.addLayer(marker);
  var socket = io();
  
  socket.on('update location', function(obj) {
       // Get all markers and find markers with attribute obj.name to 
       // update the location to [obj.lat,obj.lon]
  
  });
  </code></pre>