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

PHPORM-114 Implement Builder::upsert #3053

Merged
merged 3 commits into from
Jul 19, 2024
Merged

Conversation

GromNaN
Copy link
Member

@GromNaN GromNaN commented Jul 18, 2024

Fix PHPORM-114

Laravel documentation for this method: https://laravel.com/docs/11.x/eloquent#upserts

Unlike createOrFirst and firstOrCreate, there is no event triggered on the model by this operation. So we can use MongoDB's bulk write operation to perform multiple upserts in a single command.

Checklist

  • Add tests and ensure they pass
  • Add an entry to the CHANGELOG.md file
  • Update documentation for new features

@GromNaN GromNaN added this to the 4.7 milestone Jul 18, 2024
@GromNaN GromNaN requested a review from a team as a code owner July 18, 2024 15:10
@GromNaN GromNaN requested a review from alcaeus July 18, 2024 15:10
@GromNaN GromNaN changed the title PHPORM-114 Implement Builder::upsert PHPORM-114 Implement Builder::upsert Jul 18, 2024
src/Query/Builder.php Outdated Show resolved Hide resolved
src/Query/Builder.php Outdated Show resolved Hide resolved
tests/ModelTest.php Outdated Show resolved Hide resolved
@GromNaN GromNaN requested a review from alcaeus July 19, 2024 08:03
@GromNaN GromNaN merged commit acaba1a into mongodb:4.7 Jul 19, 2024
26 checks passed
@GromNaN GromNaN deleted the PHPORM-114 branch July 19, 2024 08:30
rustagir pushed a commit to rustagir/laravel-mongodb that referenced this pull request Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants