Skip to content

Commit

Permalink
Use internal call to select_server
Browse files Browse the repository at this point in the history
This allows to make `select_server` function private in future release.
  • Loading branch information
hauleth committed Aug 7, 2019
1 parent 7a1fc2c commit 7a33f8d
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 7a33f8d

Please sign in to comment.