The following path cannot be queried:

default discord avatar
last month

I'm getting this error:

message: 'The following path cannot be queried: vowelArray.vowelSound'

Here's my query:

const query = {
      "vowelArray.vowelSound.value.slug": {
        equals: targetWord.vowelArray[0].vowelSound.value.slug,

I have

access: {read: () => true,},

set at both the field (for troubleshooting) and collection level for the "vowel" relationship I have set up and

read: () => true

at the collection level for the "word" collection.

I see it come through in the response:

"vowelArray": [
      "syllableNumber": 1,
      "vowelSound": {
        "value": {
          "id": "64db67db910ca53cb73d30af",
          "vowel": "Long "e" like "fleece"",
          "slug": "long-e",
          "createdAt": "2023-08-15T11:56:11.366Z",
          "updatedAt": "2023-08-15T11:56:11.366Z"
        "relationTo": "vowels"
      "id": "64dbee9ce8d80d342199131b"

I am able to access the relationship using dot notation:[0].vowelArray[0].vowelSound.value.slug

but when I run the query, I get the error.

Any insight here?

Changing from “vowelArray.vowelSound” to vowelArray: {vowelSound: …} helped but the query returns all records instead of my desired result. So now I’m trying to figure that out

Okay, so this still isn't working. I can't access relationship data from my query. I tried it this way:



) for example and am getting the same "can't query path." I can use fetch on the front end to query both the vowel and word collections no problem, so it doesn't seem to be an access control issue. Would love some help here

  • discord user avatar
    Payload Team
    last month

    is a key of a document object, not a value in the


    array. Try changing





  • discord user avatar
    Payload Team
    last month

    @nlvogel can you paste in your vowelArray field config? Sounds like you might want to use a relationship field with


    instead of an array field type.

  • default discord avatar
    last month

    @tylandavis @jarrod_not_jared thanks for dropping in! I think my problem was not understanding how the query should be structured. I just got this working before your messages came through. What I did was change the relationship from "Has One - Polymorphic" to just Has One and then changed my query to

    `const query = {
          "vowelArray.vowelSound": {
            equals: targetWord.vowelArray[0]
          word: {
            not_equals: targetWord.word,
            not_in: targetWord.homophones.homophone,

    - I'm sure I could have gotten this working as a polymorphic relationship not that I've figured out that I don't have to drill all the way down to the value I want like


    in my above example.

    I'm going to confirm this is working as intended before marking as solved.

  • default discord avatar
    last month

    Oh wow I literally just asked this same question

    What is your suggestion for querying polymorphics?

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!


Connect with the Payload Community on Discord



Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.