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

Nor() public static method

Tests that none of the subqueries is true (see $nor).
public static Nor ( ) : QueryComplete
return QueryComplete
        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);
        }

Usage Example

        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());
        }
All Usage Examples Of MongoDB.Driver.Builders.DeprecatedQuery::Nor