glucinater
glucinater17mo ago

Indexes with spaces not scanning

When trying to define an index with a field that has a space, I get the following error:
400 Bad Request: InvalidBundle: Hit an error while evaluating your schema:
InvalidIndexField: Invalid index field: First Name
400 Bad Request: InvalidBundle: Hit an error while evaluating your schema:
InvalidIndexField: Invalid index field: First Name
No description
4 Replies
sshader
sshader17mo ago
Oof sorry for the unhelpful error message -- the issue is that all fields in indexes must be valid identifiers (alphanumeric + _ strings that do not start with a number). So if you're able to rename your fields to FirstName (or First_Name), I believe the index definition should work (and hopefully that first index definition with Catalog and Subject works for you). We'll look into improving the error message here as well as improving documentation
glucinater
glucinaterOP17mo ago
Is there a way to rename fields in the dashboard? I tried but the only thing I could find was clearing and reuploading via the cli which not ideal
sshader
sshader17mo ago
Hmm not sure if there's a way to bulk edit fields in the dashboard. I've done this type of rename before by writing a mutation that loads my documents and runs a db.patch or db.replace and run it from the "Functions" page on the dashboard
sshader
sshader17mo ago
https://stack.convex.dev/migrating-data-with-mutations has some useful helpers, especially if you already have a lot of data
Migrating Data With Mutations
Using mutations to migrate data in Convex.

Did you find this page helpful?