I am using Mongo CSharpDriver-2.0.0 version and IMongoCollection Async in my application. My data collection looks as shown in the figure attached(2.png).
Here I want to perform a Search operation on Venue Details, basically we will give a pair of Latitude and Longitude and it should return a list of Records that are with in the distance of 4000 meters from provided Latitude and Longitude.
To implement above functionality I am using the below code: This code works fine when I pass a single category.
IMongoCollection<BusinessDeal> BusinessCollection;
            BusinessCollection = _database.GetCollection<BusinessDeal>("BusinessDeals2");
            double? rangeInMeters = null;
            if (rangeInMeters == null)
            //add index for venue.location and category
            var keyBuilder = Builders<BusinessDeal>.IndexKeys;
            keyBuilder.Geo2DSphere(x => x.Venuedetails.Select(y => y.Location)).Ascending(x => x.Categories.Select(y => y.Id));
            keyBuilder.Geo2DSphere(x => x.Venuedetails.Select(y => y.Location)).Ascending(x => x.Accessgroups.Select(y => y.Id));
            BsonDocument geoPoint = new BsonDocument
            {
                
,
                {"coordinates",new BsonArray(new double[]{-84.289156, 34.289156})}
            };
            BsonDocument geoNearOptions = new BsonDocument
            {
                
,
                
,should we do a filter first?
                
,              
                
,
{"distanceField","dist"}};
var stage = new BsonDocumentPipelineStageDefinition<BusinessDeal, BusinessDeal>(new BsonDocument {
{ "$geoNear", geoNearOptions }});
            var colAggregate = BusinessCollection.Aggregate().AppendStage(stage);
            var result = BusinessCollection.Aggregate().ToListAsync();
            _businessDealsList = result.Result;
The above code is returning all the records that are in the Collection. But there are only 2 records that are 4000 meters of distance. My records are as follows:
	Latitude1	Longitude1	Latitude2	Longitude2	Distance from Origin in Meters
Record1	-84.289156	34.289156	-84.288357	34.068686	2414.016
Record2	-84.289156	34.289156	-84.299477	34.069886	2735.8848
Record3	-84.289156	34.289156	-84.299477	34.690986	4667.0976
When I run or Debug the code, it returns all the three records. But it should return only 2 records. Please review the code that I have written and help where I am going wrong. Thanks in advance for your help and support.