Closed MarkNijhof closed 8 years ago
Found a way, was mostly a difference in command from Mongo shell and internal:
{:ok, response} = Mongo.connect!
|> Mongo.db(prefix)
|> Mongo.Db.cmd_sync(%{listCollections: true})
{:ok, %{cursor: %{firstBatch: collections} } } = Mongo.Response.cmd(response)
names = collections |> Enum.map(fn(%{name: name}) -> name end) |> Enum.sort
I am trying to execute: db.getCollectionNames() using f.ex. Mongo.Db.cmd() but I am not succeeding. Is there a way to directly execute a command against mongodb?