Mongo.Repo.fetch_by

You're seeing just the callback fetch_by, go back to Mongo.Repo module for more information.
Link to this callback

fetch_by(module, query, opts)

View Source (optional)

Specs

fetch_by(module :: module(), query :: BSON.document(), 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 query 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_by(Post, %{title: title})
MyApp.Repo.fetch_by(Post, %{title: title}, read_concern: %{level: "local"})