count implemented for couchdb