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.
Glad you figured it out. I had not seen that error before. Just to clarify, this was just because of an invalid value for
useAsTitle
?
@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.
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.