Problem with searching in relationship field

default discord avatar
3 months ago
3 1

We have a collection "customers" that has around 100 records in it. Four other collections have a relationship field relating to "customers." When running locally and connected to a local mongoDB, there are no issues and one can easily use the search bar on the other collections "customer" relationship field to select the appropriate "customer record" for the relationship field. However, when running the application remotely and connected to a remote mongoDB, we start running into issues.

If, we search for a record that is not included in the first 10 records returned, the record will not be found and "no options" will appear in the dropdown, then if we scroll down the dropdown, no more options are fetched. If we refresh the page and scroll down the options list instead of searching, the options will continue to fetch the customer records options and we are able to find and select the appropriate record.

Any ideas as to what might be causing this?

  • default discord avatar
    3 months ago

    Including the fields we were using to search ("name", "id") in the "listSearchableFields" array under the collection config and then setting "index: true" on the field, solved this issue for us.

Open the post
Continue the discussion in GitHub
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.