Skip to content
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

fix: find docs query without projection #500

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .formatter.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
inputs: [
"*.{ex,exs}",
"{config,lib,test,priv}/**/*.{ex,exs}",
"apps/*/{config,lib,test,priv}/**/*.{ex,exs}"
"{apps,libs}/*/{config,lib,test,priv}/**/*.{ex,exs}"
],
line_length: 120
]
28 changes: 14 additions & 14 deletions libs/application_runner/lib/controllers/docs_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,7 @@ defmodule ApplicationRunner.DocsController do
doc_id,
transaction_id
]) do
Logger.debug(
"#{__MODULE__} respond to #{inspect(conn.method)} on #{inspect(conn.request_path)} with status :ok"
)
Logger.debug("#{__MODULE__} respond to #{inspect(conn.method)} on #{inspect(conn.request_path)} with status :ok")

reply(conn)
end
Expand All @@ -230,9 +228,7 @@ defmodule ApplicationRunner.DocsController do
) do
with :ok <-
MongoInstance.run_mongo_task(env.id, MongoStorage, :delete_doc, [env.id, coll, doc_id]) do
Logger.debug(
"#{__MODULE__} respond to #{inspect(conn.method)} on #{inspect(conn.request_path)} with status :ok"
)
Logger.debug("#{__MODULE__} respond to #{inspect(conn.method)} on #{inspect(conn.request_path)} with status :ok")

reply(conn)
end
Expand Down Expand Up @@ -278,7 +274,15 @@ defmodule ApplicationRunner.DocsController do
end
end

def find(conn, %{"coll" => coll}, filter, %{environment: env}, replace_params) do
def find(
conn,
%{"coll" => coll},
%{
"query" => query
},
%{environment: env},
replace_params
) do
Logger.warning(
"This form of query is deprecated, prefer using: {query: <your query>, projection: {projection}}, more info at: https://www.mongodb.com/docs/manual/reference/method/db.collection.find/#mongodb-method-db.collection.find"
)
Expand All @@ -287,7 +291,7 @@ defmodule ApplicationRunner.DocsController do
MongoInstance.run_mongo_task(env.id, MongoStorage, :filter_docs, [
env.id,
coll,
Parser.replace_params(filter, replace_params)
Parser.replace_params(query, replace_params)
]) do
Logger.debug(
"#{__MODULE__} respond to #{inspect(conn.method)} on #{inspect(conn.request_path)} with res #{inspect(docs)}"
Expand Down Expand Up @@ -370,9 +374,7 @@ defmodule ApplicationRunner.DocsController do
transaction_id,
env.id
]) do
Logger.debug(
"#{__MODULE__} respond to #{inspect(conn.method)} on #{inspect(conn.request_path)} with status :ok"
)
Logger.debug("#{__MODULE__} respond to #{inspect(conn.method)} on #{inspect(conn.request_path)} with status :ok")

reply(conn)
end
Expand All @@ -390,9 +392,7 @@ defmodule ApplicationRunner.DocsController do
transaction_id,
env.id
]) do
Logger.debug(
"#{__MODULE__} respond to #{inspect(conn.method)} on #{inspect(conn.request_path)} with status :ok"
)
Logger.debug("#{__MODULE__} respond to #{inspect(conn.method)} on #{inspect(conn.request_path)} with status :ok")

reply(conn)
end
Expand Down
Loading