Mongo.Repo.fetch
You're seeing just the callback
fetch
, go back to Mongo.Repo module for more information.
Specs
fetch(module :: module(), id :: BSON.ObjectId.t(), opts :: Keyword.t()) :: {:ok, Mongo.Collection.t()} | {:error, :not_found} | {:error, any()}
Returns a single document struct for the collection defined in the given module and bson object id as
a tuple of {:ok, document}
.
Returns {:error, :not_found}
if no result was found.
If multiple documents satisfy the query, this method returns the first document according to the natural order which reflects the order of documents on the disk.
For all options see Options
Example
MyApp.Repo.fetch(Post, id)
MyApp.Repo.fetch(Post, id, read_concern: %{level: "local"})