MoviesDotNetCore solution does not return new movie I added to movies database

I added a movie to the the example Movie database provided by Neo4J. This query (taken from the .NET MovieRepository returns the movie I added when I run the query in the neo4j browser, but not in the .NET MoviesDotNetCore solution. I even added an index on the movie.title property. Has anyone experienced this?

		MATCH (movie:Movie)
                    WHERE toLower(movie.title) CONTAINS toLower('unbroken')
                    RETURN movie.title AS title,
                           movie.released AS released,
                           movie.tagline AS tagline,
                           movie.votes AS votes

Hi @artistrybean

Can you put a link to which solution you are talking about?

Charlotte

This app provided by Neo4j

Hi @artistrybean

Just to cover the bases, are you sure you are using the same database? By default, the database used in the demo project is read-only. It contains a similar dataset as if you had configured a database with :play movies on your database. so would be an easy mistake to make.

I am using the same database. I added a movie in the neo4j browser.

CREATE (unbroken:Movie {title:'Unbroken', released:2019, tagline:'psychopath'})
CREATE (daffy:Person {name:'daffy duck'})
CREATE
(daffy)-[:ACTED_IN {roles:['himself']}]->(unbroken)

The movie I added is returned when I run a query for it in the neo4j browser. The reason I did this is because I experienced the same issue in a sandbox database I created with some simple objects I added.

Is it a database you are running locally or using AuraDB?

I'm running it locally

I experience the same thing with the node.js version of the movie application.

I am unsurprised you are seeing similar behavior when using the javascript driver; there is no reason your results would not be shown that would come from the drivers.

I have taken your additional movie and added it into my local db, and run the demo solution locally - and things are working ok.

Now.

I have changed the code in 2 places, basically as I'm very anti-environment variables:

In startup.cs

I replaced the AddSingleton call with this: (around line 27)

services.AddSingleton(GraphDatabase.Driver(
    "neo4j://localhost:7687", AuthTokens.Basic("neo4j", "neo4jneo4j"))); 
    //obvs, use your user/pass here

Then I changed the MoviesRepository.cs changing the the WithDatabase method (around line 144) to this:

private static void WithDatabase(SessionConfigBuilder sessionConfigBuilder)
{
   sessionConfigBuilder.WithDatabase("neo4j"); //You should use your DB name here
}

Both of these areas used Environment Vars to get information (neo4j version, user/pass etc) that I think introduced complexity you don't need.

Can you try this and see how you go?

Charlotte

1 Like

Sorry if I wasn't clear that the web apps have no problem retrieving the Matrix movies and all of the other movies that are loaded with the cypher script that populates the movie database. It just doesn't return the movie that I added. The reason I did the experiment is that I'm trying some data modeling in a different database and the entity that I added to the database is not returned by the .NET driver but the same query is returned when I run the same query in the Neo4j browser. I still don't know why. It is frustrating because I can't recommend Neo4j if can't get a simple demo app to work, no matter how well the data is returned when I query in the neo4j browser.

Why the matrix and other movies would be returned to the web apps, except the one I added is what perplexes me, as queries in the neo4j browser return the one I added as well as the ones loaded by the script, such as the matrix movies.

Did you look at the picture I put up? It's returning the 'Unbroken' movie?

Am I missing something?

Sorry I missed that in the picture. I'll try implementing your changes.

Okey dokes, if that works, then we're entering into the ball park of where the issue lies.

My guess is that the reliance on Environment Vars in the solution means that either defaults are being used that you're not aware of - largely as they are hidden, or not in one central 'settings' location.

I made the changes to and it is still not returning unbroken, though it returns any of the other movies. For unbroken it just returns an empty array. Very strange. I added an index on movies.title and that doesn't help.

So. A few questions:

  1. Where is your local DB?
  • Is it running in Desktop?
  1. Do you have the movies DB on the default database?

  2. Do you have any environment variables set for Neo4j?

  3. Have you made any other changes to the code?

  4. Can you turn off your local neo4j instance and run the app - does it return any results?

  • Similar - can you turn off your wifi/internet and see if it works?
  1. The ConfigureServices method should look like this:
  // This method gets called by the runtime. Use this method to add services to the container.
  public void ConfigureServices(IServiceCollection services)
  {
      services.AddControllers();
      services.AddScoped<IMovieRepository, MovieRepository>();
      services.AddSingleton(GraphDatabase.Driver(
          "neo4j://localhost:7687", AuthTokens.Basic("neo4j", "neo4jneo4j")));
  }

You don't want any other calls after that (nb. this is for testing purposes - I just want to rule out everything)

I thought that "NEO4J_URI": "neo4j+s://demo.neo4jlabs.com", is a local endpoint. Now I see that it is external and hosted by Neo4j. I copied the method now, exactly as you suggested and I get an authentication error. Are those credentials for the movies database or for all databases on your machine?

Those are the credentials for my server on my local instance.

The username for you will likely be neo4j, but the password will be what you set it to when you created the database initially

I never changed it from the default "secretpassword", and that is not authenticating for me from the web app. Is there way to change it?

There isn't a default password on desktop, whenever you create your dB you get asked for a password.

You can change it if you've forgotten it by clicking on your dB, and in the panel that opens up on the right hand side there is a change password option