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

Size() public static method

Tests that the size of the named array is equal to some value (see $size).
public static Size ( string name, int size ) : QueryConditionList
name string The name of the element to test.
size int The size to compare to.
return QueryConditionList
        public static QueryConditionList Size(string name, int size)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            return new QueryConditionList(name).Size(size);
        }

Usage Example

        public void TestSizeAndAll()
        {
            var query    = Query.Size("k", 20).All(7, 11);
            var expected = "{ \"k\" : { \"$size\" : 20, \"$all\" : [7, 11] } }";

            Assert.AreEqual(expected, query.ToJson());
        }
All Usage Examples Of MongoDB.Driver.Builders.DeprecatedQuery::Size