mtranter / CypherNet

A .Net API for the Neo4j HTTP Transactional Endpoint
Microsoft Public License
55 stars 23 forks source link

Trouble querying nodes of specific label (type) #8

Closed snap608 closed 8 years ago

snap608 commented 10 years ago

Probably my noobness but this query should return only nodes labeled "Movie" right? It actually return all nodes in the database.

var nodes = cypherEndpoint
    .BeginQuery(p => new {Movie = p.Node})
    .Match(ctx => ctx.Node(ctx.Vars.Movie))
    .Return(ctx => new {Movie = ctx.Vars.Movie})
    .Fetch();

The code generates: MATCH (Movie) RETURN Movie as Movie, id(Movie) as MovieId, labels(Movie) as MovieLabels

But should generate: MATCH (Movie:Movie) RETURN Movie as Movie, id(Movie) as MovieId, labels(Movie) as MovieLabels

Am I missing something here in my code? :)

snap608 commented 10 years ago

Found an alternative way:

var nodes = cypherEndpoint
      .BeginQuery(p => new { Movie = p.Node })
      .Match(ctx => ctx.NodeLabelled(ctx.Vars.Movie, "Movie"))
      .Return(ctx => new { Movie = ctx.Vars.Movie })
      .Fetch();