Refactor get collection operation.
Fix creating autoincrement collection and cover it with test.