better CouchDb findAll() / count() logic