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

Prevent duplicates while seeding #104

Open
dominicrico opened this issue Feb 25, 2020 · 3 comments
Open

Prevent duplicates while seeding #104

dominicrico opened this issue Feb 25, 2020 · 3 comments
Labels
area/core Refers to Mongo Seeding library 🚀 enhancement New feature or request

Comments

@dominicrico
Copy link

Like other ORM-based seeders, it would be awesome if the seeding runs would be stored in collection to prevent duplicates within the seeded collection. For example sequelize (mysql orm) is storing timestamp and file names in a separate table to prevent that.

Keep up the good work!

@pkosiec
Copy link
Owner

pkosiec commented Feb 26, 2020

Hi @dominicrico, thanks for the idea and kind words! That's good idea, I will consider it for future releases.

@pkosiec pkosiec added area/core Refers to Mongo Seeding library 🚀 enhancement New feature or request labels Feb 26, 2020
@ronan-f
Copy link

ronan-f commented May 31, 2022

@pkosiec I agree with @dominicrico this would be a great feature to add. Would you be open to a PR for this functionality? I'm not 100% sure how it could be implemented yet but looking at this line it seems like it would need changed to handle the duplicate case.

Edit: Setting the ordered param to false seems promising: https://stackoverflow.com/questions/61480444/mongodb-insertmany-and-skip-duplicates

@pkosiec
Copy link
Owner

pkosiec commented Jun 19, 2022

Hi @ronan-f 👋, sorry for a long delay.

Sure thing! The PR that implements this functionality is very welcome (as far as it is opt-in feature that doesn't break existing behavior) 🙂 Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core Refers to Mongo Seeding library 🚀 enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants