orientechnologies / orientjs

The official fast, lightweight node.js client for OrientDB
http://orientdb.com
Other
326 stars 68 forks source link

Documentation Change: Transaction Builder with orientdb v3.X.X #363

Open creisle opened 5 years ago

creisle commented 5 years ago

orientjs version

v3.0.4

orientdb version

v3.0.14

OS version

Centos07

Following the examples here http://orientdb.com/docs/3.0.x/orientjs/OrientJS-Transactions.html I am migrating code that previously worked with orientdb 2.X.X. However now the same function will no longer work, Could we add to the documentation a note to specify this to users?

Using orientdb v2 the documentation example works, in v3 I need to change

.let('career', function(c){
      c.create('edge', 'playsFor')
         .from('$player')
         .to('$team')
         .set({
            startYear: '1905',
            endYear:   '1926'
         })
   })

to

.let('career', function(c){
      c.create('edge', 'playsFor')
         .from('$player[0]')
         .to('$team[0]')
         .set({
            startYear: '1905',
            endYear:   '1926'
         })
   })

Because create now returns a record list not a single record (as far as I can tell)

This is related to https://github.com/orientechnologies/orientdb/issues/8786