For FeedItems this works in SOQL:
[SELECT Id FROM FeedItem WHERE Parent.Type = :mySObjectType]
But for FeedComment it is not a valid query:
Didn't understand relationship 'Parent' in field path
So I also tried to filter by key prefix:
String prefix = mySObjectType.getDescribe().getKeyPrefix() + '%';
[SELECT Id FROM FeedComment WHERE ParentId LIKE :prefix]
leads to:
invalid operator on id field
Is there any other workaround, or even a clean way to select Comments posted on a parent of a certain type?
EDIT:
Also tried
[SELECT Id FROM FeedComment WHERE FeedItem.Parent.Type = :mySObjectType]
Didn't understand relationship 'FeedItem' in field path
Best Answer
Sometimes fields declared as Reference do not really work as references. In such cases you need to use some ugly workarounds like this one: