title: neo4j cypher nested collect
body: <p>Imagine a photo album schema w/ Users, Albums, and Photos:</p>
  
  <pre><code>User -[owns]-&gt; Album -[contains]-&gt; Photo
  </code></pre>
  
  <p>Can I do a nested collect to get Photos nested in Albums, and Albums nested in User? I'd like results similar to:</p>
  
  <pre><code>{ "users": [
      { "name": "roger dodger",
        "albums": [
          { "album": "album1",
            "photos": [
              {"url": "photo1.jpg"},
              {"url": "photo2.jpg"}
            ]
          }
        ]
      }
    ]
  }
  </code></pre>
  
  <p>This seems close but I could not modify it to suit my needs: <a href="https://stackoverflow.com/questions/20682024/nested-has-many-relationships-in-cypher">Nested has_many relationships in cypher</a> 
  (Could the problem be that neo4j 2.0 web console doesn't support the json syntax in that example?)</p>