Skip to content

Commit

Permalink
Clarify :returning option for inserts (#4007)
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanl authored Nov 10, 2022
1 parent 6215dcf commit e150ac9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/ecto/repo.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1525,7 1525,9 @@ defmodule Ecto.Repo do
* Specify `read_after_writes: true` in your schema for choosing
fields that are read from the database after every operation.
Or pass `returning: true` to `insert` to read all fields back:
Or pass `returning: true` to `insert` to read all fields back.
(Note that it will only read from the database if at least one
field is updated).
MyRepo.insert(%Post{title: "this is unique"}, returning: true,
on_conflict: on_conflict, conflict_target: :title)
Expand Down

0 comments on commit e150ac9

Please sign in to comment.