Skip to content

Commit

Permalink
Merge pull request elixir-mongo#309 from kobil-systems/fix/use-direct…
Browse files Browse the repository at this point in the history
…-call

Use internal call to select_server
  • Loading branch information
ankhers authored Aug 7, 2019
2 parents 7a1fc2c + 7a33f8d commit 43c0ca2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/mongo.ex
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,7 @@ defmodule Mongo do
"""
@spec list_indexes(GenServer.server(), String.t(), Keyword.t()) :: cursor
def list_indexes(topology_pid, coll, opts \\ []) do
with {:ok, conn, _, _} <- Mongo.select_server(topology_pid, :read, opts) do
with {:ok, conn, _, _} <- select_server(topology_pid, :read, opts) do
aggregation_cursor(conn, "$cmd", [listIndexes: coll], nil, opts)
end
end
Expand All @@ -1005,7 +1005,7 @@ defmodule Mongo do
#
# In versions 2.8.0-rc3 and later, the listCollections command returns a cursor!
#
with {:ok, conn, _, _} <- Mongo.select_server(topology_pid, :read, opts) do
with {:ok, conn, _, _} <- select_server(topology_pid, :read, opts) do
aggregation_cursor(conn, "$cmd", [listCollections: 1], nil, opts)
|> Stream.filter(fn coll -> coll["type"] == "collection" end)
|> Stream.map(fn coll -> coll["name"] end)
Expand Down

0 comments on commit 43c0ca2

Please sign in to comment.