MongoDB.Driver.Builders.DeprecatedQuery.WithinCircle C# (CSharp) Method

WithinCircle() public static method

Tests that the value of the named element is within a circle (see $within and $center).
public static WithinCircle ( string name, double centerX, double centerY, double radius ) : QueryConditionList
name string The name of the element to test.
centerX double The x coordinate of the origin.
centerY double The y coordinate of the origin.
radius double The radius of the circle.
return QueryConditionList
        public static QueryConditionList WithinCircle(string name, double centerX, double centerY, double radius)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            return new QueryConditionList(name).WithinCircle(centerX, centerY, radius);
        }

Same methods

DeprecatedQuery::WithinCircle ( string name, double centerX, double centerY, double radius, bool spherical ) : QueryConditionList

Usage Example

        public void TestWithinCircleSpherical()
        {
            var query    = Query.WithinCircle("loc", 1.1, 2.2, 3.3, true);
            var expected = "{ 'loc' : { '$within' : { '$centerSphere' : [[1.1, 2.2], 3.3] } } }".Replace("'", "\"");

            Assert.AreEqual(expected, query.ToJson());
        }