MongoDB.Driver.Builders.GeoNearOptionsBuilder.SetSpherical C# (CSharp) Method

SetSpherical() public method

Sets whether to use a spherical search.
public SetSpherical ( bool value ) : GeoNearOptionsBuilder
value bool Whether to use a spherical search.
return GeoNearOptionsBuilder
        public GeoNearOptionsBuilder SetSpherical(bool value)
        {
            if (value)
            {
                _document["spherical"] = true;
            }
            else
            {
                _document.Remove("spherical");
            }
            return this;
        }

Usage Example

示例#1
0
 private void cmdGeoNear_Click(object sender, EventArgs e)
 {
     GeoNearOptionsBuilder GeoOption = new GeoNearOptionsBuilder();
     GeoOption.SetDistanceMultiplier(double.Parse(NumDistanceMultiplier.Text));
     GeoOption.SetMaxDistance(double.Parse(NumMaxDistance.Text));
     GeoOption.SetSpherical(chkSpherical.Checked);
     try
     {
         BsonDocument mGeoNearAs = SystemManager.GetCurrentCollection().GeoNearAs<BsonDocument>
             (null, double.Parse(NumGeoX.Text), double.Parse(NumGeoY.Text), (int)NumResultCount.Value, GeoOption).Response;
         MongoDBHelper.FillDataToTreeView("Result", this.trvGeoResult, mGeoNearAs);
         this.trvGeoResult.DatatreeView.Nodes[0].Expand();
     }
     catch (Exception ex)
     {
         SystemManager.ExceptionDeal(ex);
     }
 }
All Usage Examples Of MongoDB.Driver.Builders.GeoNearOptionsBuilder::SetSpherical