FatEcto v0.2.0 FatEcto.FatQuery.FatWhere View Source
Where supports multiple query methods.
=> like
Parameters
queryable
- Schema name that represents your database model.query_opts
- include query options as a map.
Example
iex> query_opts = %{
...> "$select" => %{"$fields" => ["name", "designation", "experience_years"]},
...> "$where" => %{"name" => %{"$like" => "%Joh %"}}
...> }
iex> Elixir.FatEcto.FatQuery.build(FatEcto.FatDoctor, query_opts)
#Ecto.Query<from f in FatEcto.FatDoctor, where: like(fragment("(?)::TEXT", f.name), ^"%Joh %") and ^true, select: map(f, [:name, :designation, :experience_years])>
Options
$select
- Select the fields fromdoctor
.$like
- Added the like attribute in the where query.
=> iLike
Parameters
queryable
- Schema name that represents your database model.query_opts
- include query options as a map.
Example
iex> query_opts = %{
...> "$select" => %{"$fields" => ["name", "designation", "experience_years"]},
...> "$where" => %{"designation" => %{"$ilike" => "%surge %"}},
...> "$order" => %{"rating" => "$asc"}
...> }
iex> Elixir.FatEcto.FatQuery.build(FatEcto.FatDoctor, query_opts)
#Ecto.Query<from f in FatEcto.FatDoctor, where: ilike(fragment("(?)::TEXT", f.designation), ^"%surge %") and ^true, order_by: [asc: f.rating], select: map(f, [:name, :designation, :experience_years])>
Options
$select
- Select the fields fromdoctor
.$ilike
- Added the ilike attribute in the where query.$order
- Sort the result based on the order attribute.
=> notLike
Parameters
queryable
- Schema name that represents your database model.query_opts
- include query options as a map.
Example
iex> query_opts = %{
...> "$select" => %{
...> "$fields" => ["name", "location", "rating"],
...> "fat_rooms" => ["beds", "capacity"],
...> },
...> "$where" => %{"location" => %{"$not_like" => "%street2 %"}},
...> "$order" => %{"id" => "$desc"}
...> }
iex> Elixir.FatEcto.FatQuery.build(FatEcto.FatHospital, query_opts)
#Ecto.Query<from f in FatEcto.FatHospital, where: not(like(fragment("(?)::TEXT", f.location), ^"%street2 %")) and ^true, order_by: [desc: f.id], select: map(f, [:name, :location, :rating, :id, {:fat_rooms, [:beds, :capacity]}])>
Options
$select
- Select the fields fromhospital
androoms
.$not_like
- Added the notlike attribute in the where query.$order
- Sort the result based on the order attribute.
=> notILike
Parameters
queryable
- Schema name that represents your database model.query_opts
- include query options as a map.
Example
iex> query_opts = %{
...> "$select" => %{
...> "$fields" => ["name", "location", "rating"]
...> },
...> "$where" => %{"location" => %{"$not_ilike" => "%street2 %"}},
...> "$group" => "rating"
...> }
iex> Elixir.FatEcto.FatQuery.build(FatEcto.FatHospital, query_opts)
#Ecto.Query<from f in FatEcto.FatHospital, where: not(ilike(fragment("(?)::TEXT", f.location), ^"%street2 %")) and ^true, group_by: [f.rating], select: map(f, [:name, :location, :rating])>
Options
$select
- Select the fields fromhospital
androoms
.$not_ilike
- Added the notilike attribute in the where query.$group
- Added the group_by attribute in the query.
=> lessThan
Parameters
queryable
- Schema name that represents your database model.query_opts
- include query options as a map
Example
iex> query_opts = %{
...> "$select" => %{
...> "$fields" => ["name", "location", "rating"]
...> },
...> "$where" => %{"rating" => %{"$lt" => 4}}
...> }
iex> Elixir.FatEcto.FatQuery.build(FatEcto.FatHospital, query_opts)
#Ecto.Query<from f in FatEcto.FatHospital, where: f.rating < ^4 and ^true, select: map(f, [:name, :location, :rating])>
Options
$select
- Select the fields fromhospital
.$lt
- Added the lessthan attribute in the where query.
=> lessThan the other field
Parameters
queryable
- Schema name that represents your database model.query_opts
- include query options as a map.
Example
iex> query_opts = %{
...> "$select" => %{
...> "$fields" => ["name", "location", "rating"]
...> },
...> "$where" => %{"total_staff" => %{"$lt" => "$rating"}},
...> "$order" => %{"id" => "$desc"}
...> }
iex> Elixir.FatEcto.FatQuery.build(FatEcto.FatHospital, query_opts)
#Ecto.Query<from f in FatEcto.FatHospital, where: f.total_staff < f.rating and ^true, order_by: [desc: f.id], select: map(f, [:name, :location, :rating])>
Options
$select
- Select the fields fromhospital
.$lt: :$field
- Added the lessthan attribute in the where query.$order
- Sort the result based on the order attribute.
=> lessThanEqual
Parameters
queryable
- Schema name that represents your database model.query_opts
- include query options as a map.
Example
iex> query_opts = %{
...> "$select" => %{
...> "$fields" => ["name", "location", "rating"],
...> "fat_rooms" => ["beds", "capacity"]
...> },
...> "$where" => %{"total_staff" => %{"$lte" => 3}},
...> }
iex> Elixir.FatEcto.FatQuery.build(FatEcto.FatHospital, query_opts)
#Ecto.Query<from f in FatEcto.FatHospital, where: f.total_staff <= ^3 and ^true, select: map(f, [:name, :location, :rating, :id, {:fat_rooms, [:beds, :capacity]}])>
Options
$select
- Select the fields fromhospital
androoms
.$lte
- Added the lessthanequal attribute in the where query.
=> lessThanEqual the other field
Parameters
queryable
- Schema name that represents your database model.query_opts
- include query options as a map.
Example
iex> query_opts = %{
...> "$select" => %{
...> "$fields" => ["name", "location", "rating"],
...> "fat_rooms" => ["beds", "capacity"]
...> },
...> "$where" => %{"total_staff" => %{"$lte" => "$rating"}},
...> "$group" => "total_staff"
...> }
iex> Elixir.FatEcto.FatQuery.build(FatEcto.FatHospital, query_opts)
#Ecto.Query<from f in FatEcto.FatHospital, where: f.total_staff <= f.rating and ^true, group_by: [f.total_staff], select: map(f, [:name, :location, :rating, :id, {:fat_rooms, [:beds, :capacity]}])>
Options
$select
- Select the fields fromhospital
androoms
.$lte: :$field
- Added the lessthanequal attribute in the where query.$group
- Added the group_by attribute in the query.
=> greaterThan
Parameters
queryable
- Schema name that represents your database model.query_opts
- include query options as a map.
Example
iex> query_opts = %{
...> "$select" => %{
...> "$fields" => ["name", "location", "rating"],
...> "fat_rooms" => ["beds", "capacity"]
...> },
...> "$where" => %{"total_staff" => %{"$gt" => 4}},
...> "$group" => "total_staff",
...> "$order" => %{"rating" => "$desc"}
...> }
iex> Elixir.FatEcto.FatQuery.build(FatEcto.FatHospital, query_opts)
#Ecto.Query<from f in FatEcto.FatHospital, where: f.total_staff > ^4 and ^true, group_by: [f.total_staff], order_by: [desc: f.rating], select: map(f, [:name, :location, :rating, :id, {:fat_rooms, [:beds, :capacity]}])>
Options
$select
- Select the fields fromhospital
androoms
.$gt
- Added the lessthan attribute in the where query.$group
- Added the group_by attribute in the query.$order
- Sort the result based on the order attribute.
=> greaterThan the other field
Parameters
queryable
- Schema name that represents your database model.query_opts
- include query options as a map.
Example
iex> query_opts = %{
...> "$select" => %{
...> "$fields" => ["name", "location", "rating"],
...> "fat_rooms" => ["beds", "capacity"]
...> },
...> "$where" => %{"total_staff" => %{"$gt" => "$rating"}},
...> "$include" => %{
...> "fat_doctors" => %{
...> "$where" => %{"rating" => %{"$lt" => 3}},
...> "$order" => %{"id" => "$desc"}
...> }
...> }
...> }
iex> Elixir.FatEcto.FatQuery.build(FatEcto.FatHospital, query_opts)
#Ecto.Query<from f0 in FatEcto.FatHospital, join: f1 in assoc(f0, :fat_doctors), where: f0.total_staff > f0.rating and ^true, select: map(f0, [:name, :location, :rating, :id, {:fat_rooms, [:beds, :capacity]}]), preload: [fat_doctors: #Ecto.Query<from f in FatEcto.FatDoctor, where: f.rating < ^3 and ^true, order_by: [desc: f.id], limit: ^10, offset: ^0>]>
Options
$select
- Select the fields fromhospital
.$gt: :$field
- Added the greaterthan attribute in the where query.$include
- Include the assoication modeldoctors
.$lt
- Added the lessthan attribute in the where query inside include.
=> greaterThanEqual
Parameters
queryable
- Schema name that represents your database model.query_opts
- include query options as a map.
Example
iex> query_opts = %{
...> "$select" => %{
...> "$fields" => ["name", "location", "rating"],
...> "fat_rooms" => ["beds", "capacity"]
...> },
...> "$where" => %{"total_staff" => %{"$gte" => 5}},
...> "$include" => %{
...> "fat_doctors" => %{
...> "$where" => %{"rating" => %{"$lte" => 3}},
...> }
...> }
...> }
iex> Elixir.FatEcto.FatQuery.build(FatEcto.FatHospital, query_opts)
#Ecto.Query<from f0 in FatEcto.FatHospital, join: f1 in assoc(f0, :fat_doctors), where: f0.total_staff >= ^5 and ^true, select: map(f0, [:name, :location, :rating, :id, {:fat_rooms, [:beds, :capacity]}]), preload: [fat_doctors: #Ecto.Query<from f in FatEcto.FatDoctor, where: f.rating <= ^3 and ^true, limit: ^10, offset: ^0>]>
Options
$select
- Select the fields fromhospital
androoms
.$gte
- Added the greaterthanequal attribute in the where query.$include
- Include the assoication modeldoctors
.$lte
- Added the lessthanequal attribute in the where query inside include.
=> greaterThanEqual the other field
Parameters
queryable
- Schema name that represents your database model.query_opts
- include query options as a map.
Example
iex> query_opts = %{
...> "$select" => %{
...> "$fields" => ["name", "location", "rating"],
...> "fat_rooms" => ["beds", "capacity"]
...> },
...> "$where" => %{"rating" => %{"$gte" => "$total_staff"}},
...> "$include" => %{
...> "fat_doctors" => %{
...> "$where" => %{"rating" => %{"$gte" => 3}},
...> "$order" => %{"rating" => "$asc"}
...> }
...> }
...> }
iex> Elixir.FatEcto.FatQuery.build(FatEcto.FatHospital, query_opts)
#Ecto.Query<from f0 in FatEcto.FatHospital, join: f1 in assoc(f0, :fat_doctors), where: f0.rating >= f0.total_staff and ^true, select: map(f0, [:name, :location, :rating, :id, {:fat_rooms, [:beds, :capacity]}]), preload: [fat_doctors: #Ecto.Query<from f in FatEcto.FatDoctor, where: f.rating >= ^3 and ^true, order_by: [asc: f.rating], limit: ^10, offset: ^0>]>
Options
$select
- Select the fields fromhospital
androoms
.$gte: :$field
- Added the greaterthanequal attribute in the where query.$include
- Include the assoication modeldoctors
.$gte
- Added the greaterthanequal attribute in the where query inside include.$order
- Sort the result based on the order attribute.
=> between
Parameters
queryable
- Schema name that represents your database model.query_opts
- include query options as a map.
Example
iex> query_opts = %{
...> "$select" => %{
...> "$fields" => ["name", "location", "rating"],
...> "fat_rooms" => ["beds", "capacity"]
...> },
...> "$where" => %{"rating" => %{"$between" => [10, 20]}},
...> "$include" => %{
...> "fat_doctors" => %{
...> "$include" => ["fat_patients"],
...> "$where" => %{"rating" => %{"$gte" => "$total_staff"}},
...> "$order" => %{"rating" => "$asc"}
...> }
...> }
...> }
iex> Elixir.FatEcto.FatQuery.build(FatEcto.FatHospital, query_opts)
#Ecto.Query<from f0 in FatEcto.FatHospital, join: f1 in assoc(f0, :fat_doctors), where: f0.rating > ^10 and f0.rating < ^20 and ^true, select: map(f0, [:name, :location, :rating, :id, {:fat_rooms, [:beds, :capacity]}]), preload: [fat_doctors: #Ecto.Query<from f in FatEcto.FatDoctor, where: f.rating >= f.total_staff and ^true, order_by: [asc: f.rating], limit: ^10, offset: ^0, preload: [:fat_patients]>]>
Options
$select
- Select the fields fromhospital
androoms
.$between: :$field
- Added the between attribute in the where query.$include
- Include the assoication modeldoctors
andpatients
.$gte
- Added the greaterthanequal attribute in the where query inside include.$order
- Sort the result based on the order attribute.
=> not_between
Parameters
queryable
- Schema name that represents your database model.query_opts
- include query options as a map.
Example
iex> query_opts = %{
...> "$select" => %{
...> "$fields" => ["name", "location", "rating"],
...> "fat_rooms" => ["beds", "capacity"]
...> },
...> "$where" => %{"rating" => %{"$not_between" => [10, 20]}},
...> "$include" => %{
...> "fat_doctors" => %{
...> "$include" => ["fat_patients"],
...> "$where" => %{"rating" => %{"$between" => [20, 30]}},
...> "$order" => %{"experience_years" => "$asc"}
...> }
...> }
...> }
iex> Elixir.FatEcto.FatQuery.build(FatEcto.FatHospital, query_opts)
#Ecto.Query<from f0 in FatEcto.FatHospital, join: f1 in assoc(f0, :fat_doctors), where: (f0.rating < ^10 or f0.rating > ^20) and ^true, select: map(f0, [:name, :location, :rating, :id, {:fat_rooms, [:beds, :capacity]}]), preload: [fat_doctors: #Ecto.Query<from f in FatEcto.FatDoctor, where: f.rating > ^20 and f.rating < ^30 and ^true, order_by: [asc: f.experience_years], limit: ^10, offset: ^0, preload: [:fat_patients]>]>
Options
$select
- Select the fields fromhospital
androoms
.$not_between: :$field
- Added the notbetween attribute in the where query.$include
- Include the assoication modeldoctors
andpatients
.$between
- Added the between attribute in the where query inside include.$order
- Sort the result based on the order attribute.
=> in
Parameters
queryable
- Schema name that represents your database model.query_opts
- include query options as a map.
Example
iex> query_opts = %{
...> "$select" => %{
...> "$fields" => ["name", "location", "rating"],
...> "fat_rooms" => ["beds", "capacity"]
...> },
...> "$where" => %{"rating" => %{"$in" => [10, 20]}},
...> "$include" => %{
...> "fat_doctors" => %{
...> "$include" => ["fat_patients"],
...> "$where" => %{"rating" => %{"$not_between" => [20, 30]}},
...> "$order" => %{"experience_years" => "$asc"}
...> }
...> },
...> "$right_join" => %{
...> "fat_rooms" => %{
...> "$on_field" => "id",
...> "$on_join_table_field" => "hospital_id",
...> "$select" => ["beds", "capacity", "level"],
...> "$where" => %{"beds" => %{"$gte" => "$nurses"}}
...> }
...> }
...> }
iex> Elixir.FatEcto.FatQuery.build(FatEcto.FatHospital, query_opts)
#Ecto.Query<from f0 in FatEcto.FatHospital, right_join: f1 in "fat_rooms", on: f0.id == f1.hospital_id, join: f2 in assoc(f0, :fat_doctors), where: f0.rating in ^[10, 20] and ^true, where: f1.beds >= f1.nurses and ^true, select: merge(map(f0, [:name, :location, :rating, :id, {:fat_rooms, [:beds, :capacity]}]), %{^:fat_rooms => map(f1, [:beds, :capacity, :level])}), preload: [fat_doctors: #Ecto.Query<from f in FatEcto.FatDoctor, where: (f.rating < ^20 or f.rating > ^30) and ^true, order_by: [asc: f.experience_years], limit: ^10, offset: ^0, preload: [:fat_patients]>]>
Options
$select
- Select the fields fromhospital
androoms
.$right_join: :$select
- Select the fields fromrooms
.$right_join
- Right join the tablerooms
.$gte: :$field
- Added the greaterthanequal attribute in the where query inside join.$include
- Include the assoication modeldoctors
andpatients
.$not_between
- Added the notbetween in the where query inside include .$in
- Added the in attribute in the where query.$order
- Sort the result based on the order attribute.
=> not_in
Parameters
queryable
- Schema name that represents your database model.query_opts
- include query options as a map.
Example
iex> query_opts = %{
...> "$select" => %{
...> "$fields" => ["name", "location", "rating"],
...> "fat_rooms" => ["beds", "capacity"]
...> },
...> "$where" => %{"rating" => %{"$not_in" => [10, 20]}},
...> "$include" => %{
...> "fat_doctors" => %{
...> "$include" => ["fat_patients"],
...> "$where" => %{"rating" => %{"$not_between" => [20, 30]}},
...> "$order" => %{"rating" => "$desc"}
...> }
...> },
...> "$right_join" => %{
...> "fat_rooms" => %{
...> "$on_field" => "id",
...> "$on_join_table_field" => "hospital_id",
...> "$select" => ["beds", "capacity", "level"],
...> "$where" => %{"beds" => %{"$not_in" => [5, 15]}}
...> }
...> }
...> }
iex> Elixir.FatEcto.FatQuery.build(FatEcto.FatHospital, query_opts)
#Ecto.Query<from f0 in FatEcto.FatHospital, right_join: f1 in "fat_rooms", on: f0.id == f1.hospital_id, join: f2 in assoc(f0, :fat_doctors), where: f0.rating not in ^[10, 20] and ^true, where: f1.beds not in ^[5, 15] and ^true, select: merge(map(f0, [:name, :location, :rating, :id, {:fat_rooms, [:beds, :capacity]}]), %{^:fat_rooms => map(f1, [:beds, :capacity, :level])}), preload: [fat_doctors: #Ecto.Query<from f in FatEcto.FatDoctor, where: (f.rating < ^20 or f.rating > ^30) and ^true, order_by: [desc: f.rating], limit: ^10, offset: ^0, preload: [:fat_patients]>]>
Options
$select
- Select the fields fromhospital
androoms
.$right_join: :$select
- Select the fields fromrooms
.$right_join
- Right join the tablerooms
.$not_in
- Added the notin attribute in the where query inside join.$include
- Include the assoication modeldoctors
andpatients
.$not_between
- Added the notbetween in the where query inside include .$not_in
- Added the in attribute in the where query.$order
- Sort the result based on the order attribute.
=> is_nil
Parameters
queryable
- Schema name that represents your database model.query_opts
- include query options as a map.
Example
iex> query_opts = %{
...> "$select" => %{
...> "$fields" => ["name", "location", "rating"],
...> "fat_rooms" => ["beds", "capacity"]
...> },
...> "$where" => %{"rating" => nil},
...> "$include" => %{
...> "fat_doctors" => %{
...> "$include" => ["fat_patients"],
...> "$where" => %{"rating" => %{"$between" => [20, 30]}},
...> "$order" => %{"experience_years" => "$desc"}
...> }
...> },
...> "$right_join" => %{
...> "fat_rooms" => %{
...> "$on_field" => "id",
...> "$on_join_table_field" => "hospital_id",
...> "$select" => ["beds", "capacity", "level"],
...> "$where" => %{"beds" => %{"$in" => [5, 15]}},
...> "$order" => %{"id" => "$asc"}
...> }
...> }
...> }
iex> Elixir.FatEcto.FatQuery.build(FatEcto.FatHospital, query_opts)
#Ecto.Query<from f0 in FatEcto.FatHospital, right_join: f1 in "fat_rooms", on: f0.id == f1.hospital_id, join: f2 in assoc(f0, :fat_doctors), where: is_nil(f0.rating) and ^true, where: f1.beds in ^[5, 15] and ^true, order_by: [asc: f1.id], select: merge(map(f0, [:name, :location, :rating, :id, {:fat_rooms, [:beds, :capacity]}]), %{^:fat_rooms => map(f1, [:beds, :capacity, :level])}), preload: [fat_doctors: #Ecto.Query<from f in FatEcto.FatDoctor, where: f.rating > ^20 and f.rating < ^30 and ^true, order_by: [desc: f.experience_years], limit: ^10, offset: ^0, preload: [:fat_patients]>]>
Options
$select
- Select the fields fromhospital
androoms
.$right_join: :$select
- Select the fields fromrooms
.$right_join
- Right join the tablerooms
.$in
- Added the in attribute in the where query inside join.$include
- Include the assoication modeldoctors
andpatients
.$between
- Added the between in the where query inside include .nil
- Added the nil attribute in the where query.$order
- Sort the result based on the order attribute.$right_join: :$order
- Sort the result based on the order attribute inside join.
=> not_null
Parameters
queryable
- Schema name that represents your database model.query_opts
- include query options as a map.
Example
iex> query_opts = %{
...> "$select" => %{
...> "$fields" => ["name", "location", "rating"],
...> "fat_rooms" => ["beds", "capacity"]
...> },
...> "$where" => %{"$not_null" => ["total_staff"]},
...> "$include" => %{
...> "fat_doctors" => %{
...> "$include" => ["fat_patients"],
...> "$where" => %{"rating" => %{"$in" => [20, 30]}},
...> "$order" => %{"rating" => "$asc"},
...> "$select" => ["name", "designation", "phone"]
...> }
...> },
...> "$right_join" => %{
...> "fat_rooms" => %{
...> "$on_field" => "id",
...> "$on_join_table_field" => "hospital_id",
...> "$select" => ["beds", "capacity", "level"],
...> "$where" => %{"beds" => nil},
...> "$order" => %{"id" => "$asc"}
...> }
...> }
...> }
iex> Elixir.FatEcto.FatQuery.build(FatEcto.FatHospital, query_opts)
#Ecto.Query<from f0 in FatEcto.FatHospital, right_join: f1 in "fat_rooms", on: f0.id == f1.hospital_id, join: f2 in assoc(f0, :fat_doctors), where: not(is_nil(f0.total_staff)) and ^true, where: is_nil(f1.beds) and ^true, order_by: [asc: f1.id], select: merge(map(f0, [:name, :location, :rating, :id, {:fat_rooms, [:beds, :capacity]}]), %{^:fat_rooms => map(f1, [:beds, :capacity, :level])}), preload: [fat_doctors: #Ecto.Query<from f in FatEcto.FatDoctor, where: f.rating in ^[20, 30] and ^true, order_by: [asc: f.rating], limit: ^10, offset: ^0, select: map(f, [:name, :designation, :phone]), preload: [:fat_patients]>]>
Options
$select
- Select the fields fromhospital
androoms
.$right_join: :$select
- Select the fields fromrooms
.$include: :$select
- Select the fields fromdoctors
.$right_join
- Right join the tablerooms
.nil
- Added the nil attribute in the where query inside join.$include
- Include the assoication modeldoctors
andpatients
.$in
- Added the in attribute in the where query inside include .$not_null
- Added the notnil attribute in the where query.$order
- Sort the result based on the order attribute.$right_join: :$order
- Sort the result based on the order attribute inside join.
=> field
Parameters
queryable
- Schema name that represents your database model.query_opts
- include query options as a map.
Example
iex> query_opts = %{
...> "$select" => %{
...> "$fields" => ["name", "location", "rating"],
...> "fat_rooms" => ["beds", "capacity"]
...> },
...> "$where" => %{"name" => "saint claire"},
...> "$group" => "rating",
...> "$include" => %{
...> "fat_doctors" => %{
...> "$include" => ["fat_patients"],
...> "$where" => %{"rating" => %{"$gt" => 5}},
...> "$order" => %{"experience_years" => "$desc"},
...> "$select" => ["name", "designation", "phone"]
...> }
...> },
...> "$right_join" => %{
...> "fat_rooms" => %{
...> "$on_field" => "id",
...> "$on_join_table_field" => "hospital_id",
...> "$select" => ["beds", "capacity", "level"],
...> "$where" => %{"beds" => 10},
...> "$order" => %{"id" => "$asc"}
...> }
...> }
...> }
iex> Elixir.FatEcto.FatQuery.build(FatEcto.FatHospital, query_opts)
#Ecto.Query<from f0 in FatEcto.FatHospital, right_join: f1 in "fat_rooms", on: f0.id == f1.hospital_id, join: f2 in assoc(f0, :fat_doctors), where: f0.name == ^"saint claire" and ^true, where: f1.beds == ^10 and ^true, group_by: [f0.rating], order_by: [asc: f1.id], select: merge(map(f0, [:name, :location, :rating, :id, {:fat_rooms, [:beds, :capacity]}]), %{^:fat_rooms => map(f1, [:beds, :capacity, :level])}), preload: [fat_doctors: #Ecto.Query<from f in FatEcto.FatDoctor, where: f.rating > ^5 and ^true, order_by: [desc: f.experience_years], limit: ^10, offset: ^0, select: map(f, [:name, :designation, :phone]), preload: [:fat_patients]>]>
Options
$select
- Select the fields fromhospital
androoms
.$right_join: :$select
- Select the fields fromrooms
.$include: :$select
- Select the fields fromdoctors
.$right_join
- Right join the tablerooms
.$include
- Include the assoication modeldoctors
andpatients
.$gt
- Added the greaterthan attribute in the where query inside include .$order
- Sort the result based on the order attribute.$right_join: :$order
- Sort the result based on the order attribute inside join.$group
- Added the group_by attribute in the query.