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

Where() public static method

Tests that a JavaScript expression is true (see $where).
public static Where ( BsonJavaScript javaScript ) : QueryComplete
javaScript BsonJavaScript The where clause.
return QueryComplete
        public static QueryComplete Where(BsonJavaScript javaScript)
        {
            if (javaScript == null)
            {
                throw new ArgumentNullException("javaScript");
            }
            return new QueryComplete(new BsonDocument("$where", javaScript));
        }

Usage Example

        public void TestWhere()
        {
            var query    = Query.Where("this.a > 3");
            var expected = "{ \"$where\" : { \"$code\" : \"this.a > 3\" } }";

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