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

Mod() public static method

Tests that the modulus of the value of the named element matches some value (see $mod).
public static Mod ( string name, int modulus, int equals ) : QueryConditionList
name string The name of the element to test.
modulus int The modulus.
equals int The value to compare to.
return QueryConditionList
        public static QueryConditionList Mod(string name, int modulus, int equals)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            return new QueryConditionList(name).Mod(modulus, equals);
        }

Usage Example

        public void TestMod()
        {
            var query    = Query.Mod("a", 10, 1);
            var expected = "{ \"a\" : { \"$mod\" : [10, 1] } }";

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