Skip to content

DOCSP-35978: Insert multiple usage example #2849

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

Merged
merged 11 commits into from
Apr 16, 2024
Merged

DOCSP-35978: Insert multiple usage example #2849

merged 11 commits into from
Apr 16, 2024

Conversation

norareidy
Copy link
Contributor

@norareidy norareidy commented Apr 11, 2024

JIRA - https://jira.mongodb.org/browse/DOCSP-35978
Staging - https://preview-mongodbnorareidy.gatsbyjs.io/laravel/DOCSP-35978/usage-examples/insertMany/

Checklist

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


.. tip::

To learn more about insert operations, see the :ref:`laravel-fundamentals-insert-documents` section
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: will merge after #2804

$result = Movie::insert([
[
'title' => 'Anatomy of a Fall',
'year' => 2023,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should add an example with a DateTime object, because casts are not applied when Model::insert is used. I think we've already discussed this with @ccho-mongodb in another PR, which I can't find.

'released_at' => new UTCDateTime(new DateTimeImmutable('2023-01-01'))

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you mention why we need to explicitly set the UTCDateTime? (because model casts are not applied).

Copy link
Contributor

@mongoKart mongoKart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM + a couple small things. Nice job!

@norareidy norareidy requested a review from GromNaN April 12, 2024 18:22
@norareidy norareidy marked this pull request as ready for review April 12, 2024 19:03
@norareidy norareidy requested a review from a team as a code owner April 12, 2024 19:03
@ccho-mongodb ccho-mongodb merged commit 2f929dd into mongodb:4.1 Apr 16, 2024
This was referenced Apr 16, 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.

4 participants