MongoFramework icon indicating copy to clipboard operation
MongoFramework copied to clipboard

GeoNear queries fail for nested coordinates within an array

Open Turnerj opened this issue 3 years ago • 0 comments

public class TestObject
{
	public string Id { get; set; }
	public List<Location> Locations { get; set; }
}

public class Location
{
	[Index(IndexType.Geo2dSphere)]
	public GeoJsonPoint<GeoJson2DGeographicCoordinates> Coords { get; set; }
}

await context.TestObjects.SearchGeoNear(t => t.Locations[0].Coords, new GeoJsonPoint<GeoJson2DGeographicCoordinates>(
	new GeoJson2DGeographicCoordinates(144.963058, -37.813629)
)).ToListAsync();

The expression t.Locations[0].Coords resolves as Locations.0.Coords which is fine for other things but I believe MongoDB is looking for Locations.Coords so we need to be smarter with the field resolution here.

Turnerj avatar May 01 '22 08:05 Turnerj