下面的代码显示了使用节点 js 从图形数据库中提取数据。数据提取正常但是当我使用过滤器(where)时它给出空结果
The code below shows the extracting data from graph db using node js. the data is extracting fine but when I use filter (where) it gives empty result
g.v()
.has('label','Event')
.not(has('active',false)).as('Event').order().by('createdTimestamp', decr)
.project('label','event', 'user')
.by(constant('Livestream'))
.by(
__.select('Event')
.project('id', 'label', 'name', 'cover', 'description', 'allowComments', 'active', 'hashtags', 'partitionValue', 'userId', 'createdTimestamp', 'createdDate')
.by('id').by('label').by('name').by('cover').by('description').by('allowComments')
.by(
coalesce(
values('active'),
constant(true)
)
)
.by('hashtags')
.by('partitionValue').by('userId').by('createdTimestamp').by('createdDate')
)
.by(
__.in('USERcreatedEVENT')
.project('id', 'privacy', 'label', 'email', 'username', 'name', 'displayPic')
.by('id').by('privacy').by('label').by('email').by('username').by('name').by('displayPic')
)
.where(select('privacy').is(eq('PUBLIC')))
这是我根据用户隐私过滤需要数据的代码。我正在这样做,但它不起作用你能在这方面帮助我吗?下面的代码显示了使用节点 js 从图形数据库中提取数据。数据提取正常,但是当我使用过滤器(where)时,它给出了空结果。如果您还需要一些信息,请问我。
如果我做对了,那么您正在尝试过滤 in
顶点的 privacy
属性 等于 public
.[=16 的结果=]
我可以告诉您为什么此查询返回空结果。因为没有设置 privacy
标签,当你写 select('privacy')
时,没有这样的标签,因此与不存在的标签进行相等比较会过滤掉所有内容。
你可以试试:
g.V().
has('label', 'Event').
not(has('active', false)).as('Event').
order().by('createdTimestamp', decr).
project('label', 'event', 'user').
by(constant('Livestream')).
by(
select('Event').
project( 'id', 'label', 'name', 'cover', 'description', 'allowComments',
'active', 'hashtags', 'partitionValue', 'userId', 'createdTimestamp',
'createdDate').
by('id'). by('label'). by('name'). by('cover'). by('description').
by('allowComments'). by(coalesce(values('active'), constant(true))).
by('hashtags'). by('partitionValue'). by('userId'). by('createdTimestamp').
by('createdDate')).
by(
in('USERcreatedEVENT').
project( 'id', 'privacy', 'label', 'email', 'username', 'name', 'displayPic').
by('id'). by('privacy'). by('label'). by('email'). by('username').
by('name'). by('displayPic')).
where(select('Event').in('USERcreatedEVENT').has('privacy', 'PUBLIC'))
g.v()
.has('label','Event')
.not(has('active',false)).as('Event').order().by('createdTimestamp', decr)
.project('label','event', 'user')
.by(constant('Livestream'))
.by(
__.select('Event')
.project('id', 'label', 'name', 'cover', 'description', 'allowComments', 'active', 'hashtags', 'partitionValue', 'userId', 'createdTimestamp', 'createdDate')
.by('id').by('label').by('name').by('cover').by('description').by('allowComments')
.by(
coalesce(
values('active'),
constant(true)
)
)
.by('hashtags')
.by('partitionValue').by('userId').by('createdTimestamp').by('createdDate')
)
.by(
__.in('USERcreatedEVENT')
.project('id', 'privacy', 'label', 'email', 'username', 'name', 'displayPic')
.by('id').by('privacy').by('label').by('email').by('username').by('name').by('displayPic')
)
.where(select('privacy').is(eq('PUBLIC')))
这是我根据用户隐私过滤需要数据的代码。我正在这样做,但它不起作用你能在这方面帮助我吗?下面的代码显示了使用节点 js 从图形数据库中提取数据。数据提取正常,但是当我使用过滤器(where)时,它给出了空结果。如果您还需要一些信息,请问我。
如果我做对了,那么您正在尝试过滤 in
顶点的 privacy
属性 等于 public
.[=16 的结果=]
我可以告诉您为什么此查询返回空结果。因为没有设置 privacy
标签,当你写 select('privacy')
时,没有这样的标签,因此与不存在的标签进行相等比较会过滤掉所有内容。
你可以试试:
g.V().
has('label', 'Event').
not(has('active', false)).as('Event').
order().by('createdTimestamp', decr).
project('label', 'event', 'user').
by(constant('Livestream')).
by(
select('Event').
project( 'id', 'label', 'name', 'cover', 'description', 'allowComments',
'active', 'hashtags', 'partitionValue', 'userId', 'createdTimestamp',
'createdDate').
by('id'). by('label'). by('name'). by('cover'). by('description').
by('allowComments'). by(coalesce(values('active'), constant(true))).
by('hashtags'). by('partitionValue'). by('userId'). by('createdTimestamp').
by('createdDate')).
by(
in('USERcreatedEVENT').
project( 'id', 'privacy', 'label', 'email', 'username', 'name', 'displayPic').
by('id'). by('privacy'). by('label'). by('email'). by('username').
by('name'). by('displayPic')).
where(select('Event').in('USERcreatedEVENT').has('privacy', 'PUBLIC'))