简体   繁体   English

如何在Oriento中访问批处理语句中的结果

[英]How to access results within batch statements in oriento

How do I access the newly inserted @rid in my second batch statement. 如何在第二个批处理语句中访问新插入的@rid。 I need to be able to access the @rid from the first statement. 我需要能够从第一条语句访问@rid。

var member = {
    'email': 'test@test.com',
    '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();

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') .set('from = $ insert')

Cheers 干杯

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM