We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi y'all! I have a model with such an unique index:
schema.index({ userId: 1, labelId: 1 }, { unique: true })
So I find myself repeating the following code:
Model.findOne({ clientId, labelId }).then(instance => { if (instance) return instance return factory.create('model', { clientId, labelId }) })
Would there be a better way of doing this through factory-girl?
Thank you!
The text was updated successfully, but these errors were encountered:
We could add an upsert method to the FactoryGirl, Factory and Adapter classes. Feel free to write a PR for this 👍
upsert
Sorry, something went wrong.
No branches or pull requests
Hi y'all! I have a model with such an unique index:
So I find myself repeating the following code:
Would there be a better way of doing this through factory-girl?
Thank you!
The text was updated successfully, but these errors were encountered: