I want to get the max price of all products using product collection. I tried the below but it didn't work
$collection = $this->_productFactory->create()
->getCollection()
->joinField('category_id', 'catalog/category_product', 'category_id', 'product_id = entity_id', null, 'left')
->addAttributeToSelect('*')
->addAttributeToFilter('status', 1)
->setOrder('price', 'ASC')
->addAttributeToFilter('visibility', 4)
->getFirstItem();
print_r($collection->getPrice());
How to get max price and min price of products from product collection in magento 2?