Skip to content

Commit

Permalink
Merge pull request #85 from joeapearson/fix-warnings-3
Browse files Browse the repository at this point in the history
Thank you!
  • Loading branch information
zookzook authored Mar 5, 2021
2 parents 6b3be9d + 06437dc commit 5a9dc74
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
7 changes: 3 additions & 4 deletions lib/mongo/grid_fs/bucket.ex
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,15 @@ defmodule Mongo.GridFs.Bucket do
end

@doc """
Finds one file document with the file_id as a string
Finds one file document by `file_id` specified either as a string or `BSON.ObjectId`.
"""
def find_one(bucket, file_id)

@spec find_one(Bucket.t, String.t) :: BSON.document | nil
def find_one(%Bucket{} = bucket, file_id) when is_binary(file_id) do
find_one(bucket, ObjectId.decode!(file_id))
end

@doc """
Finds one file document with the file_id as an ObjectID-struct
"""
@spec find_one(Bucket.t, BSON.ObjectId.t) :: BSON.document | nil
def find_one(%Bucket{topology_pid: topology_pid, opts: opts} = bucket, %BSON.ObjectId{} = oid) do
Mongo.find_one(topology_pid, files_collection_name(bucket), %{"_id" => oid}, opts)
Expand Down
9 changes: 6 additions & 3 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ defmodule Mongodb.Mixfile do
defp elixirc_paths(_), do: ["lib"]

def application() do
[applications: applications(Mix.env),
mod: {Mongo.App, []},
env: []]
[
applications: applications(Mix.env),
env: [],
extra_applications: [:crypto, :ssl],
mod: {Mongo.App, []}
]
end

def applications(:test), do: [:logger, :connection, :db_connection]
Expand Down

0 comments on commit 5a9dc74

Please sign in to comment.