Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unique slug for Compound indexes #7

Open
nicky-lenaers opened this issue Nov 17, 2016 · 4 comments
Open

Unique slug for Compound indexes #7

nicky-lenaers opened this issue Nov 17, 2016 · 4 comments

Comments

@nicky-lenaers
Copy link

Hi,

I came across a case in my project where I would like to generate a unique slug, so I used your plugin. However, I'd like to have a unique slug per user, in other word, a Mongoose Compound Index (see here). For example:

/user-1/project-1
/user-2/project-1

should both the valid, even though the project-1 is generated using the unique slug generator. Would it be possible to implement this in your plugin?

Thanks!

@rickogden
Copy link

I have added this feature on my own fork of this project by adding a uniqueGroup option:
https://github.com/rickogden/mongoose-slug-generator

@YuriGor
Copy link

YuriGor commented Oct 26, 2018

@rickogden you may be interested in fixing your uniqueGroup feature, it doesn't work correctly in some cases:

  • when we move doc with compound slug to another group with same docs - slug not updated
  • but when we move doc with shortId slug to another group with same docs - slug should not be changed(in most cases)

watcher fields list should be updated by fields from uniqueGroup like I did it here
And here is how I check if we can keep old shortId

@rickogden
Copy link

Hi @YuriGor,

Thanks for pointing this out to me. Unfortunately I don't have the time to update this at the moment and I no longer have any projects which use it. Please feel free to submit a PR though!

@YuriGor
Copy link

YuriGor commented Oct 26, 2018

My fork moved too far from original so PR will be too painful)
With this notification I just wanted to thank you @rickogden for the useful feature I merged and fixed then, so if you don't need it anymore - it's ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants