-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
when creating a new place document, the pre hook attempts to come up with a new unique slug that can be used as part of a URL. Here's one way to screw that up:
- Create a new place with a name of 'abc'. Slug for it will be 'abc'
- Create another place with the same name of 'abc'. Slug for it will be 'abc-2'
- Create another place with the name of 'abc-3'. Slug for it will be 'abc-3'
- Create another place with the name of 'abc' again. Slug will be 'abc-3'
In step 4, mongoose will throw its hands up in the air and give up on everything because 'abc-3' as a slug already exists. I don't know what's the best way to fix this issue besides using a while loop to keep checking if a potential slug is valid.
Metadata
Metadata
Assignees
Labels
No labels