Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
07-14-2021 10:29 AM
I am using R/Shiny with Apollo and the Neo4j GraphQL Library. I am inferring my schema using this:
const inferAugmentedSchema = driver => {
return inferSchema(driver).then(result => {
console.log(result.typeDefs)
return makeAugmentedSchema({
typeDefs: result.typeDefs
});
});
};
The schema point of interest is:
type Skill {
_id: Long!
name: String!
projects_in_need_of: [Project] @relation(name: "IN_NEED_OF", direction: IN)
}
type Project {
_id: Long!
description: String
name: String!
}
My query is:
execute_query = function(query) {
result <- conn$exec(Query$new()$query('link', query)$link)
flat_result <- result %>% fromJSON(flatten = F)
print(flat_result)
result.df <- as.data.frame(flat_result[[1]])
print(result.df)
output$table <- DT::renderDataTable({result.df}, rownames = TRUE, filter = 'top', selection = 'single', extensions = 'Buttons')
}
# Run a query
execute_query('
query SampleQuery {
Skill{
name
projects_in_need_of{
name
description
}
}
}
')
The code will return the name of the skill, then it will return skill.projects_in_need_of instead of the name, and description. When it has a project to return, it returns [object Object]
I can't figure out if it is my query or not- I am new to this and using a template!
07-15-2021 05:25 AM
Does the query work if you just use graphql-playground or graphiql?
If you're just starting out you should consider moving to neo4j/graphql which is the new, officially supported library
07-15-2021 08:21 AM
If I copy and paste the query into the GraphQL playground API, it works! It must be something in my code. I don't know why it's not returning to the application.
The organization and team I belong to is using this template so I cannot move to the neo4j/graphql
07-19-2021 08:22 AM
I switched to the new driver and my query worked for two runs before it started returning the node object and not the attributes.
08-19-2021 02:26 PM
Can you add some log messages in between, not sure if the library has logging? Or step debug through it?
All the sessions of the conference are now available online