public static Matches ( string name, BsonRegularExpression regex ) : |
||
name | string | The name of the element to test. |
regex | BsonRegularExpression | The regular expression to match against. |
return |
public static QueryComplete Matches(string name, BsonRegularExpression regex)
{
if (name == null)
{
throw new ArgumentNullException("name");
}
if (regex == null)
{
throw new ArgumentNullException("regex");
}
return new QueryComplete(new BsonDocument(name, regex));
}
public void TestMatches() { var query = Query.Matches("a", "/abc/"); var expected = "{ 'a' : /abc/ }".Replace("'", "\""); Assert.AreEqual(expected, query.ToJson()); }