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

Not() public static method

Tests that the value of the named element does not match any of the tests that follow (see $not).
public static Not ( string name ) : QueryNot
name string The name of the element to test.
return QueryNot
        public static QueryNot Not(string name)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            return new QueryNot(name);
        }

Usage Example

        public void TestNotRegex()
        {
            var query    = Query.Not("name").Matches(new BsonRegularExpression("acme.*corp", "i"));
            var expected = "{ \"name\" : { \"$not\" : /acme.*corp/i } }";
            JsonWriterSettings settings = new JsonWriterSettings {
                OutputMode = JsonOutputMode.JavaScript
            };
            var actual = query.ToJson(settings);

            Assert.AreEqual(expected, actual);
        }
All Usage Examples Of MongoDB.Driver.Builders.DeprecatedQuery::Not