Fix 327 for incorrect filterById implementation.

Changes to QueryBuilder so it is concistent with other filterby functions and that it matches documentation. Added tests for new behaviour.