addAttributeToSelect
is not working in magento 2. i tried below but it is loading all item.
$groupCollection = $this->_productloader->create();
$groupCollection->addAttributeToFilter('sku','24-MB02');
$groupCollection->addAttributeToSelect('name,sku');
below is result
{"entity_id":"6","attribute_set_id":"15","type_id":"simple","sku":"24-MB02","has_options":"0","required_options"
:"0","created_at":"2016-04-26 06:40:51","updated_at":"2016-04-26 06:40:51","is_salable":"1"}
Best Answer
You should use an array:
Alternative: