GraphQL returning wrong data on PayloadCMS

66 views Asked by At

Getting started with PayloadCMS. With database on mongo, a document contains, among other fields, these:

filename: "some_file.wav" url: "http://localhost:3000/pieces-files/some_file.webm"

But when fetching, I get the wrong url:

url: "http://localhost:3000/pieces-files/some_file.wav"

Query used is:

query Piece($slug: String, $draft: Boolean) {
    Pieces(where: { slug: { equals: $slug }}, limit: 1, draft: $draft) {
      docs {
        id
        title
        filename
        url
        mimeType
        filesize
        composer
        album
        year
        label
        format
        description
        categories {
          title
        }
        createdAt
        user {
          id
          name
        }
      }
    }
  }

Why may this be like this?

There is only one document in this collection, and all other fields are returned correctly.

Curiously, if I change the variables of the query and instead search by url, like so:

Pieces(where: { url: { equals: $url }}, limit: 1, draft: $draft) { ...

I can only find the document if the url matches the one with .webm. If the query searches for .wav, then no docs are found.

I have tested this from inside the payload project and from postman, same results.

0

There are 0 answers