Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GeoNear queries fail for nested coordinates within an array #292

Open
Turnerj opened this issue May 1, 2022 · 0 comments
Open

GeoNear queries fail for nested coordinates within an array #292

Turnerj opened this issue May 1, 2022 · 0 comments
Labels

Comments

@Turnerj
Copy link
Member

Turnerj commented May 1, 2022

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 Turnerj added the bug label May 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant