Getting Started with OrientDB by Unknown

Getting Started with OrientDB by Unknown

Author:Unknown
Format: epub


Embedded relationships

The embedded 1:1 relationship is realized by embedding a document in a field of its owner. The embedded documents have no RIDs and follow the life cycle of the embedding document. To realize a 1:n embedded relationship, you can use one of the embedded container field type, that is, embeddedlist, embeddedset, or embeddedmap (if you want to associate a key to any embedded record). In our blog example, we can imagine that the comments of an article are embedded into the article itself. In fact, if a post is deleted, the comments also should be deleted. In our case we can do something as follows:

orientdb> create property Post.comments embeddedlist Property created successfully with id=3



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.