i have this object in my dgraph db
{
"data": {
"all": [
{
"uid": "0x1388e",
"creatorId": "8268d155-e45d-4531-9e17-16d2b9fb7ccv",
"ownerId": "8268d155-e45d-4531-9e17-16d2b9fb7cll",
"title": "testar",
"description": "duscriptiontest",
"poster": "2.png",
"logo": "logo3.png",
"categories": [
"ورزشی"
],
"publish": true,
"createdAt": "2022-01-19T19:04:31.551492863+03:30",
"updatedAt": "2022-01-19T19:04:31.551492914+03:30",
"UGCViewCount": 0,
"clipViewCount": 0,
"channel": {
"uid": "0x1388c",
"title": "testook",
"publish": true,
"createdAt": "2022-01-19T19:00:17.834570385+03:30",
"updatedAt": "2022-01-19T19:00:17.83457046+03:30",
"UGCViewCount": 0,
"clipViewCount": 0
}
}
]
}
i want query on channel fields in my object . i use following code but that is not work.
{
all(func: type(Program)) @filter(eq(Program.Channel.publish,true)){
uid,
}
}
anyone has idea about this ?
MichelDiz
(Michel Diz)
2
Your query and dataset has no context enough to have an idea.
What are the types of the objects? In which object we will find Program.Channel.publish?
my schema is
type Program{
id: ID!
ownerId: String!
creatorId:String!
title: String!
description: String!
poster: String!
logo: String!
categories: [String]!
publish: Boolean!
createdAt: DateTime!
updatedAt: DateTime!
UGCViewCount: Int!
clipViewCount: Int!
clips: [Clip] @hasInverse(field:"program")
campaigns: [Campaign] @hasInverse(field:"program")
channel: Channel @hasInverse(field:"programs")
}
type Channel {
id: ID!
title: String!
description: String!
poster: String!
logo: String!
categories: [String]!
publish: Boolean!
createdAt: DateTime!
updatedAt: DateTime!
UGCViewCount: Int!
clipViewCount: Int!
clips: [Clip] @hasInverse(field:"channel")
campaigns: [Campaign] @hasInverse(field:"channel")
programs: [Program] @hasInverse(field:"channel")
}
my object is
Program {
"uid": "0x1388e",
"creatorId": "8268d155-e45d-4531-9e17-16d2b9fb7ccv",
"ownerId": "8268d155-e45d-4531-9e17-16d2b9fb7cll",
"title": "testar",
"description": "duscriptiontest",
"poster": "2.png",
"logo": "logo3.png",
"categories": [
"ورزشی"
],
"publish": true,
"createdAt": "2022-01-19T19:04:31.551492863+03:30",
"updatedAt": "2022-01-19T19:04:31.551492914+03:30",
"UGCViewCount": 0,
"clipViewCount": 0,
"channel": {
"uid": "0x1388c",
"title": "testook",
"publish": true,
"createdAt": "2022-01-19T19:00:17.834570385+03:30",
"updatedAt": "2022-01-19T19:00:17.83457046+03:30",
"UGCViewCount": 0,
"clipViewCount": 0
}
}
Valdanito
(Valdanito)
5
Maybe it’s like this:
{
all(func: eq(Channel.publish,true)) @normalize{
~Program.channel {
uid
}
}
}
thank you valdanito.
Unfortunately its not work for me.