talha-asad / mongoose-url-slugs

Create URL compatiable slugs on mongoose models, ensuring uniqueness.
MIT License
40 stars 22 forks source link

Slug history #11

Closed phillee closed 8 years ago

phillee commented 9 years ago

When slugs change, it'd be nice to still find it though an old slug. Example:

var paul = new Model({ name : 'paul' }).save() // slug: paul
paul.name = 'george'
paul.save() // slug: george
Model.findBySlug('paul') // still returns paul, even though the slug is now george

Would probably be implemented with a slugHistory field array that tracks all past slugs Any interest in a pull request for this?

talha-asad commented 8 years ago

Yeah sure, but make sure you take care of collisions.