Skip to content
This repository was archived by the owner on Sep 3, 2021. It is now read-only.

Duplicate values in nested object values resulting from @cypher field #11

Closed
johnymontana opened this issue Nov 3, 2017 · 2 comments
Closed

Comments

@johnymontana
Copy link
Contributor

Originally reported in this Launchpad

The query

{
  Movie(title: "Kill Bill: Vol. 1") {
    title
    genres {
      name
    }
    similar(first:3) {
      title
      genres {
        name
      }
    }
  }
}

results in this Cypher query

MATCH (movie:Movie {title:"Kill Bill: Vol. 1"}) 
RETURN movie { .title ,
	genres: [(movie)-[:IN_GENRE]->(movie_genres:Genre) | movie_genres { .name }] ,
	similar: [ x IN apoc.cypher.runFirstColumn("WITH {this} AS this MATCH (this)--(:Genre)--(o:Movie) RETURN o LIMIT 5", {this: movie}, false) | x 
  		{ 
    		.title ,
			genres: [(movie_similar)-[:IN_GENRE]->(movie_similar_genres:Genre) | movie_similar_genres { .name }] }][..3] 
    	} AS movie SKIP 0

and returns duplicate genre names:

{
"data": {
    "Movie": [
      {
        "title": "Kill Bill: Vol. 1",
        "genres": [
          {
            "name": "Thriller"
          },
          {
            "name": "Crime"
          },
          {
            "name": "Action"
          }
        ],
        "similar": [
          {
            "title": "Usual Suspects, The",
            "genres": [
              {
                "name": "Adventure"
              },
              {
                "name": "Adventure"
              },
              {
                "name": "Adventure"
              },
              {
                "name": "Adventure"
              },
              {
                "name": "Adventure"
              },
              {
                "name": "Adventure"
              },
              {
                "name": "Adventure"
              },
              {
                "name": "Adventure"
              },
              {
                "name": "Adventure"
              },
...
@judas-christ
Copy link
Contributor

This looks very much like #30. Is this still a problem or is it fixed since #31?

@johnymontana
Copy link
Contributor Author

Yup, good catch @judas-christ. This was fixed by your PR #31. Thanks!

johnymontana pushed a commit that referenced this issue Oct 10, 2018
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants