add tests for #5906
fix #5906
tweaks collection tests
Merge pull request #5923 from stefanotorresi/fix/5906-collection-count-is-ignored-when-data-empty

Fix/5906 collection count is ignored when data empty
Merge branch 'hotfix/5923' into develop

Close #5923
Fixes #5906