Skip to content

Commit

Permalink
Clarify documentation for Repo.aggregate/4 (#4103)
Browse files Browse the repository at this point in the history
  • Loading branch information
noahduncan authored Feb 10, 2023
1 parent 783d3b2 commit d739211
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/ecto/repo.ex
Original file line number Diff line number Diff line change
Expand Up @@ -842,14 +842,14 @@ defmodule Ecto.Repo do
## Examples
# Returns the number of visits per blog post
Repo.aggregate(Post, :count, :visits)
# Returns the sum of the number of visits for every blog post
Repo.aggregate(Post, :sum, :visits)
# Returns the number of visits per blog post in the "private" schema path
# (in Postgres) or database (in MySQL)
Repo.aggregate(Post, :count, :visits, prefix: "private")
# Returns the sum of the number of visits for every blog post in the
# "private" schema path (in Postgres) or database (in MySQL)
Repo.aggregate(Post, :sum, :visits, prefix: "private")
# Returns the average number of visits for the top 10
# Returns the average number of visits for the first 10 blog posts
query = from Post, limit: 10
Repo.aggregate(query, :avg, :visits)
"""
Expand Down

0 comments on commit d739211

Please sign in to comment.