Skip to content

Querying for related entries by their contentType #223

@0xStarcat

Description

@0xStarcat

Hello! I'm having an issue trying to query for entries by a related entry's contentType.

I have 3 models - Resource, BlogPost and Video

I'm trying to query this model:

Resource

which has the single-reference field:

RESOURCE:

  • entry => BlogPost or Video

My query using the gem looks like this:

Content::Resource.all('fields.entry.sys.contentType.sys.id': 'blogPost', include: 4)

(the internal implementation of this should be fine, as include: 4 is passed correctly as an option along with the field query in the logs)

I get no errors.

What I get back is:

100 Resource entries, containing a mix of BlogPost and Video entries linked to the entry field

What i want is:

Only Resource entries with BlogPosts linked to the entry field

Any clue where the issue is? Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions