1

我试图在插入顶点后在回调函数中创建一条边。下面是我使用的代码。

db.query('insert into Post content :Post',{
        params: {
            Post: post
        }
    }).then(function(response){
            db.query('create edge from :PostId to :UserId',{
            params: {
                PostId : response[0].@rid,
                UserId : req.body.userid;
            }
        }).then(function(result){
            console.log('create edge'+result);
        });
        return res.json(response);
    }); 

但它会抛出一个错误,说 Unexpected token ILLEGAL pointing to @rid。我在这里做错什么了吗?或者是否有另一种创建边缘的方法?

4

1 回答 1

2

您不能在 javascript 中使用 @。

尝试

response[0]['@rid']
于 2015-12-05T19:19:02.227 回答