How to access results within batch statements in oriento

84 views Asked by At

How do I access the newly inserted @rid in my second batch statement. I need to be able to access the @rid from the first statement.

var member = {
    'email': '[email protected]',
    'id': 200,
    'lastupdated': new Date()
};

db
    .let('insert', function (s) {
        s
            .insert().into('member')
            .set(member)
    })
    .let('update', function (s) {
        s
            .update('#12:74')
            .set({
                'from': '$insert'['@rid'] // how do I access the @rid from the previous statement
            })
    })
    .commit()
    .return('$update')
    .all()
    .then(function (results) {
        console.log(results);
    })
    .done();
1

There are 1 answers

0
ycxq On BEST ANSWER

I had the same problem a couple of days ago. Finally, it turned out that the syntax in the case of a link is as follows:

.set('from=$insert')

Cheers