talha-asad / mongoose-url-slugs

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

Saving "undefined" if slug field is not selected #33

Closed nikpundik closed 6 years ago

nikpundik commented 7 years ago

Hi, I've recently updated to 1.0.0 and found this problem.

In these situations:

MyModel
 .findOne()
 .select('justOneField')
 .then(myRecord => myRecord.save())

the slug property gets set to "undefined"

talha-asad commented 6 years ago

@nikpundik This has been fixed in the latest release and a test has been added, sorry it took me a while to get to this. Thanks for reporting.