I got the Answer to my Question:
If you want to filter product collection which has no any images, so I just do some custom code on which I got the success. I hope you will get the solution from this answer.
Magento2 have 2 tables which store the value of uploaded product image
- catalog_product_entity_media_gallery_value
- catalog_product_entity_media_gallery
One table store the value_id of each products and second table contain the image url as value.
So we have to add joins in the collection to know which product have images, according to that rest of the products have no images.
In my controller file
$productCollection = $_objectManager->create('Magento\Catalog\Model\ResourceModel\Product\CollectionFactory');
$collection = $productCollection->create();
/*----Join Query for getting value id from media_gallery_value table----- */
$collection->getSelect()->join(
array('value_entity' => $collection->getTable('catalog_product_entity_media_gallery_value')),
'e.entity_id = value_entity.entity_id',
array('value_id')
);
/*----Join Query for getting value from media_gallery table using value_id----- */
$collection->getSelect()->join(
array('value_data' => $collection->getTable('catalog_product_entity_media_gallery')),
'value_entity.value_id = value_data.value_id',
array('value')
);
/*----Here, you can get the unique product ids wich have images ----- */
$collection->getSelect()
->reset(\Zend_Db_Select::COLUMNS)
->columns('entity_id')
->group(array('entity_id'));
/*---- $newCollection have product which have no images ----- */
$newCollection = $productCollection->create()
->addAttributeToFilter('entity_id',['nin'=>$collection->getData()]);
echo '<pre>';print_r($newCollection->getData());die('died');