var vPoint = new GeoJsonPoint<GeoJson2DCoordinates>(new GeoJson2DCoordinates(user_x, user_y));
var vFilter = Builders<t_s_S01>.Filter.Where(v => v.isOpen == true);
vFilter &= Builders<t_s_S01>.Filter.Where(v => v.auditInfo.auditStatus == auditInfo.auditResult_2);
if (vOpenRange)
{
vFilter &= Builders<t_s_S01>.Filter.NearSphere(v => v.coordinate, vPoint, vMaxDis);
}
List<t_s_S01> vList = new MongoDBHelper().queryData(vConnString, vDataBaseName, "t_s_S01", vFilter).ToList();
这个返回间距
var vMongoCollection = new MongoDBHelper().getMongoCollection<t_s_S01>(vConnString, vDataBaseName, "t_s_S01");
string vParameter = "{$geoNear: { near: { type: 'Point', coordinates: [ " + user_x + ", " + user_y + "] },maxDistance:" + vMaxDis + ", distanceField: 'distance',spherical: true }} ";
//var vSort = new SortDefinitionBuilder<t_s_S01_out>().Ascending(v => v.distance);
//var myQuery = PipelineDefinition<geo, geo_out>.Create(parameter).Skip(0).Limit(5).Sort(vSort);
var vQuery = PipelineDefinition<t_s_S01, t_s_S01_out>.Create(vParameter).Skip(skip).Limit(limit);
List<t_s_S01_out> vOutData = vMongoCollection.Aggregate(vQuery).ToList();
return vOutData;