default discord avatar
7 months ago

Hi there, I'm new to Payload CMS. When searching collections I am getting errors in the UI with BSONTypeError in logs due to Payload querying mongodb id field as a string. This breaks all search functionality for me in any box where I need to lookup by listSearchableFields.

[22:52:26] ERROR (payload): BSONTypeError: Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer

Okay super confusing, but it looks like if you add "useAsTitle" then it defaults to using the text field and not the ID.

  • discord user avatar
    Payload Team
    7 months ago

    Glad you figured it out. I had not seen that error before. Just to clarify, this was just because of an invalid value for



  • default discord avatar
    7 months ago

    @denolfe No, if you don't include useAsTitle the collection uses a mongo object id as it's title/search field, which is like a 24 character string. If you try to type anything in the search boxes it breaks in the UI and returns a BSONType error.

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.