public static QueryComplete Nor(params IMongoQuery[] queries) { if (queries == null) { throw new ArgumentNullException("queries"); } var clauses = new BsonArray(); foreach (var query in queries) { if (query == null) { throw new ArgumentOutOfRangeException("queries", "One of the queries is null."); } clauses.Add(query.ToBsonDocument()); } var document = new BsonDocument("$nor", clauses); return new QueryComplete(document); }
public void TestNor() { var query = Query.Nor( Query.EQ("a", 1), Query.EQ("b", 2) ); var expected = "{ \"$nor\" : [{ \"a\" : 1 }, { \"b\" : 2 }] }"; Assert.AreEqual(expected, query.ToJson()); }