dericop
Hi,
I’m using Ecto Mongodb and I want to configure a custom pool size in my plug project. I was testing a few solutions but i can’t do it successfully. Do you can help me?
This is my config.exs:
use Mix.Config
import_config "#{Mix.env()}.exs"
config :feature_flags, FeatureFlags.Repo,
adapter: Mongo.Ecto,
mongo_url: "mongodb://ip/db?"
This is my mix.exs:
defmodule FeatureFlags.MixProject do
use Mix.Project
def project do
[
app: :feature_flags,
version: "0.1.0",
elixir: "~> 1.9",
start_permanent: Mix.env() == :prod,
deps: deps()
]
end
def application do
[
extra_applications: [:logger, :plug_cowboy, :mongodb, :poolboy,:mongodb_ecto, :ecto],
mod: {FeatureFlags.Application, []}
]
end
defp deps do
[
{:plug_cowboy, "~> 2.1"},
{:poison, "~> 3.1"},
{:mongodb, ">= 0.4.9"},
{:mongodb_ecto, "~> 0.1"},
{:poolboy, ">= 1.5.2"}
]
end
end
This is my applications.exs:
defmodule FeatureFlags.Application do
@moduledoc "OTP application spec for Feature Flags"
use Application
def start(_type, _args) do
import Supervisor.Spec
IO.inspect(DBConnection.Poolboy)
children = [
worker(FeatureFlags.Repo, []),
# Use Plug.Cowboy to register the endpoint
Plug.Cowboy.child_spec(
scheme: :http,
plug: FeatureFlags.AppRestEntryPoint,
options: [port: Application.get_env(:feature_flags, :port)]
)
]
opts = [strategy: :one_for_one, name: FeatureFlags.Supervisor, pool_size: 40]
Supervisor.start_link(children, opts)
end
end
defmodule FeatureFlags.Repo do
use Ecto.Repo, otp_app: :feature_flags
end
Thanks for your help.
Trending in Questions
Hello!
Suppose you are building workflow (order / task / payment) processing system with the following requirements:
Each workflow con...
New
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app?
Looking for hints regarding:
Addi...
New
Kia ora,
We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
Hi all, I wanted to ask how the community is dealing with post-release steps.
Today we have Ecto migrations, which make sure that the db...
New
Hello,
I have an Elixir backend that implements a custom protocol over TCP. I want to load test the backend and assess the performance o...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #phoenix_html
- #iex
- #graphql
- #ai
- #genstage
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex










First Post!
zookzook
Hi dericop
instead of using Ecto with MongoDB it is a better way to use the driver api without any additional layer.
Ecto is made for SQL and MongoDB is very different. But that’s a philosophical question. In my opinion, Ecto is not necessary for the use of MongoDB. An additional level between the driver and the program is superfluous because the MongoDB documents are returned as maps. If you prefer defstructs, you can convert the maps into such. Queries as SQL-DSL are more of a headache for MongoDB and are not useful. Why should one describe MongoDB queries as SQL?
SQL-Injection in MongoDB is hardly possible because the queries do not have to be expressed as a strings but as keyword lists or maps.
Example:
In this case you are not able to fake the query, because the content of
nameis always treated as value whatever it is. You don’t need to escape values here.Good luck!