public static LT ( string name, BsonValue value ) : |
||
name | string | The name of the element to test. |
value | BsonValue | The value to compare to. |
return |
public void TestLessThan() { var query = Query.LT("k", 10); var expected = "{ \"k\" : { \"$lt\" : 10 } }"; Assert.AreEqual(expected, query.ToJson()); }
public void TestEq1() { // now that server supports $and this is actually syntactically valid var query = Query.And( Query.EQ("value", 6), Query.LT("value", 20) ); var expected = "{ '$and' : [{ 'value' : 6 }, { 'value' : { '$lt' : 20 } }] }".Replace("'", "\""); var json = query.ToJson(); Assert.AreEqual(expected, json); }
public void TestAndGtLt() { var query = Query.And( Query.NotIn("value", 1, 2, 3), Query.EQ("OtherValue", 1), Query.GT("value", 6), Query.LT("value", 20) ); Assert.AreEqual( new BsonDocument { { "value", new BsonDocument { { "$nin", new BsonArray { 1, 2, 3 } }, { "$gt", 6 }, { "$lt", 20 } } }, { "OtherValue", 1 } }, query.ToBsonDocument()); }