Validation error for field which no longer exists (with that name)

default discord avatar
spacehill
last month
5

While running dev: What could cause validation error with old field name?


I get complain about field "menu-name", but I changed to "menu_name" a little while ago, and can't no longer find references to "menu-name" in my codebase.


Already deleted: node_modules/.cache/webpack

  • default discord avatar
    noheadphones
    last month

    Is the previous field name in the database?



    That's the first place I would check when changing data structures, unless you added no data ofc @spacehill

  • default discord avatar
    Exo
    last month

    Probably you still have the index of that field in your mongodb. Use

    mongosh

    and connect to your databse, from there use

    db.<collection>.getIndexedes()

    and if you still see the associated index just drop it 🙂

  • default discord avatar
    noheadphones
    last month

    if you prefer a GUI like me, compass is solid

    https://www.mongodb.com/products/compass
  • default discord avatar
    spacehill
    last month

    Thank you guys! Old index was still there. Seems to be all good now after deleting it 👍 And yeah, using the Compass, pretty handy

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.