-
Notifications
You must be signed in to change notification settings - Fork 5
Model CRUD
topofocus edited this page Jul 15, 2019
·
3 revisions
Public API for ActiveOrient::Base-Model Objects
Create a database class
#ORD Points to the OrientDB-Instance
ORD.create_class {class_name [, class_name , ...]} # String or Symbol ## returns allocated class
Klass.create_class {class_name [, class_name}, ...]} ## creates inherited classes
# special cases
V.create_class class_names # creates vertex classes
E.create_class class_names # creates edge classesCreation and update of a single document
V.create_class :t
t = T.create property: value , (...) # creates a document, attributes go into the Hash
t.update property: value # updates the document,
# or
t.{property} = {value}
t.saveUpdate and Upsert ( query database and modify accordingly )
V.create_class :t
T.update set:{ attributes }, where: { condition }
T.upsert set:{ attributes }, where: { condition } # create a document, if where cause reveals no matchDelete
V.create_class :t
# a single document
t = T.create attr: 'value'
t.delete
# several documents
T.delete where: {attr: 'value'} || T.delete where: 'a valid condition'
# any document of database class
T.delete all: true(remember: if a vertex is deleted, all connected edges are removed, too)
Overview
Data Management
- Joining Tables, embedded Lists
- Links and Link Lists
- Relations
- Bidirectional Connections
- Working with Hashes
Public API
- Database
- Model CRUD
Misc