mirror of https://gitee.com/bigwinds/arangodb
|
||
---|---|---|
.. | ||
README.mdpp |
README.mdpp
!CHAPTER Edges, Identifiers, Handles This is an introduction to ArangoDB's interface for edges. Edges may be [used in graphs](../Graphs/README.md). Here we work with edges from the JavaScript shell *arangosh*. For other languages see the corresponding language API. A graph data model always consists of at least two collections: the relations between the nodes in the graphs are stored in an "edges collection", the nodes in the graph are stored in documents in regular collections. Edges in ArangoDB are special documents. In addition to the internal attributes *_key*, *_id* and *_rev*, they have two attributes *_from* and *_to*, which contain [document handles](../Glossary/README.md#document-handle), namely the start-point and the end-point of the edge. *Example*: - the "edge" collection stores the information that a company's reception is sub-unit to the services unit and the services unit is sub-unit to the CEO. You would express this relationship with the *_from* and *_to* attributes - the "normal" collection stores all the properties about the reception, e.g. that 20 people are working there and the room number etc - *_from* is the [document handle](../Glossary/README.md#document-handle) of the linked vertex (incoming relation) - *_to* is the document handle of the linked vertex (outgoing relation) The values of *_from* and *_to* are immutable once as edge was saved - thus you will not be able to update them. [Edge collections](../Glossary/README.md#edge-collection) are special collections that store edge documents. Edge documents are connection documents that reference other documents. The type of a collection must be specified when a collection is created and cannot be changed afterwards. To change edge endpoints you would need to remove old document/edge and insert new one. Other fields can be updated as in default collection. !SECTION Working with Edges !SUBSECTION Insert <!-- arangod/V8Server/v8-collection.cpp --> @startDocuBlock InsertEdgeCol !SUBSECTION Edges <!-- arangod/V8Server/v8-query.cpp --> @startDocuBlock edgeCollectionEdges !SUBSECTION InEdges <!-- arangod/V8Server/v8-query.cpp --> @startDocuBlock edgeCollectionInEdges !SUBSECTION OutEdges <!-- arangod/V8Server/v8-query.cpp --> @startDocuBlock edgeCollectionOutEdges