orientechnologies / orientjs

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

Weird behaviour of "rawExpression" in Transaction Builder #345

Closed petervavro closed 6 years ago

petervavro commented 6 years ago

I am running similar code :

var trx = db.let('player', function(p){

    links = db.rawExpression(`list($link1) || list($link2)`)

    p.create('vertex', 'Player')
        .set({
            name:      'Ty Cobb',
            birthDate: '1886-12-18',
            deathDate: '1961-7-17',
            batted:    'left',
            threw:     'right',
            links:      links
        })
})
.commit().return('$player').all()
.then(
    function(results){
        console.log(results);
    }
);
BEGIN;
LET player = CREATE vertex Player SET name = "Ty Cobb", birthDate: "1886-12-18", deathDate = '1961-7-17', batted = list($link1) || list($link2), threw = "right", links = list($link1) || list($link2)
COMMIT;
RETURN $player;

Issue : For some unknown reason the content of "links" is added to "batted" as well.

This weird behaviour appeared after I started to use it the way described here. Before, I was connecting to DB this way :

var server = OrientDB({
   host:     '10.0.1.5',
   port:     2424,
   username: 'root',
   password: 'root_passwd',
});

var db = server.use({
   name:     'GratefulDeadConcerts',
   username: 'admin',
   password: 'admin_passwd'
});

I will appreciate any advice, this is really weird. Thank you.

wolf4ood commented 6 years ago

@petervavro

Probably it's a bug. let me check ASAP.

Thanks

petervavro commented 6 years ago

Please do, this is something urgent. I am stucked already a few days with this. Thank you.

wolf4ood commented 6 years ago

Hi @petervavro

i've just pushed a fix. Let me wait for the CI then i can make a new release 3.0.1 with this fix

petervavro commented 6 years ago

@wolf4ood Thank you so much. I am happy you found it. I am really stucked with this one. Do you think you can provide me with the fix / code before it is released ( like now :) ), ASAP, this is really blocking me to continue, I really appreciate that.

wolf4ood commented 6 years ago

Hi @petervavro

Just published 3.0.1 on NPM with the fix. Let me know if that works for you

Thanks

petervavro commented 6 years ago

@wolf4ood BUG disappeared, works great, Thank you so much !

wolf4ood commented 6 years ago

Cool