简体   繁体   中英

Orientdb query approach to get properties of vertices and edges

我是一个定向db的新手。我有一个顶点用户,它的属性为adress,name和另一个顶点,图像的属性为imagename,date。两者均由边和边发布。现在,我想编写一个查询来选择由a所发布的所有图像具有两个顶点的所有属性的用户。如何编写查询以获取此信息。我在项目中使用orientjs

Try this:

var OrientDB = require('orientjs');
var db = OrientDB({
host: 'localhost',
port: 2424,
});
var db = db.use({
name: '<db name>',
username: '<username>',
password: '<pwd>'
});
db.query('select address, name, out("postedby").imagename as imagename, out("postedby").date as date from User where name = "<insert a name>" unwind imagename,date')
.then(function (response) {
console.log(response);
});
db.close();

Hope it helps

Regards

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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