ArangoXEcto.Schema.one_outgoing
You're seeing just the macro
one_outgoing
, go back to ArangoXEcto.Schema module for more information.
Defines an outgoing relationship of one object
Unlike outgoing/3
, this does not create a graph relation and instead places the _id
in a field in the incoming
schema. This MUST be accompanied by a one_incoming/3
definition in the other target schema.
Behind the scenes this injects the __id__
field to store the _id
value and uses the built-in Ecto has_one/3
function.
Options passed to the opts
attribute are passed to the has_many/3
definition. Refrain from overriding the
:references
and :foreign_key
attributes unless you know what you are doing.
Example
defmodule MyProject.User do
use ArangoXEcto.Schema
schema "users" do
field :name, :string
one_outgoing :best_post, MyProject.Post
end
end