resolves issue 671

This resolves issue #671. Added support for $min/$max support and tests.