title: How to store and query an array of coordinates in C# Mongodb strongly typed driver
body: <p>I am using the official C# MongoDb strongly typed driver version 2.5.0 to interact with MongoDB.</p>
  
  <p>I have an array of longitude and latitude coordinates and I want to store them in the MongoDB.</p>
  
  <p>What is the name of the class used to store an array of coordinates? So I can lately do the following query, check If a given coordinate is near any point in the array of coordinates, how to achieve this?</p>
  
  <p>Here is a simple code that demonstrate the question.</p>
  
  <pre><code>        var coordinates = new List&lt;(double latitude, double longitude)&gt;();
  
          //Store coordinates array in the database
  
          (double latitude, double longitude) point = (-33.847927, 150.6517805);
  
          int maxDistance = 300;//Max Distance in meters
  
          //Check if any point in the coordinates array is 300 m near the given point
  </code></pre>
  
  <p><strong>Edit:-</strong></p>
  
  <p>According to this question mentioned in @CodeFuller comment below:-</p>
  
  <p><a href="https://stackoverflow.com/questions/5570317/mongodb-geospatial-index-on-an-array-multikey-geospatial">MongoDB geospatial index on an array (multikey + geospatial)</a></p>
  
  <p>MongoDB doesn't support geospatial index on arrays, so consider the following classes:</p>
  
  <pre><code>class SomeDocument {
  
      public ObjectId Id { get; set; }
  
      public string Title { get; set; }
  
      public List&lt;MyClass&gt; Locations {get; set;} = new List&lt;MyClass&gt;();
  }
  
  class MyClass {
  
      public ObjectId Id { get; set; }
  
      public GeoJsonPoint&lt;GeoJson2DGeographicCoordinates&gt; Location { get; set; 
  
  }
  </code></pre>
  
  <p>How to get all instances of SomeDocument that at least have one point near a given point? And sort them by the nearest one?</p>