veliovgroup / ostrio-Neo4jreactivity

Meteor.js Neo4j database reactivity layer
https://atmospherejs.com/ostrio/neo4jreactivity
BSD 3-Clause "New" or "Revised" License
51 stars 5 forks source link

Meteor.neo4j.collection('players') and the Neo4j browser on port 7474 disagree about the contents of the database #54

Open blackslate opened 9 years ago

blackslate commented 9 years ago

I thought that the Neo4j browser running on localhost:7474 and the Meteor-Leaderboard-Neo4j app share the same data in the database. However, I am seeing some evidence that seems to contradict this.

Here are my steps.

  1. I run the application. 7 "players" are created.
  2. I delete all 7 players.
  3. I check in the Neo4j browser on port 7474 that all seven have been deleted:

    MATCH (p:Player) RETURN p // (no rows)

  4. I add 2 lines to the 2nd function argument for Players.publish('allPlayers':
    • At the beginning, when it is called: console.log("subscribe callback", Players.find().count())
    • At the end of if (Players.find({}).count() <= 0) statement, after any new players have been created: console.log("players inserted", Players.find().count())
  5. I stop Meteor and restart it.
  6. When I refresh the web page at localhost:3000, I expect to see...

    subscribe callback 0 players inserted 7

    ... in the Terminal window, and this is indeed what happens, and...

    MATCH (p:Player) RETURN p

    ... returns 7 rows. All well and good.

  7. In the browser at port 3000, I now delete each of the players by clicking on their [x] buttons. At port 7474, I check that MATCH (p:Player) RETURN p returns 0 rows. This is what I expect.
  8. I refresh the browser at port 3000.
    • In the Terminal, I see subscribe callback 7. This is unexpected. This is not what the Neo4j browser at port 7474 reports.
    • No new players are created. This is logical, given that the Meteor app believes that there are still 7 players.
    • No players appear in the browser client at port 3000. This is not logical, since the Meteor.neo4j.collection('players') object on the server still considers that there are 7 players to publish.
  9. I stop the Meteor app and restart it, then refresh the browser window for port 3000. The Terminal window now correctly indicates:

    subscribe callback 0 players inserted 7

Why does the server object created with Meteor.neo4j.collection('players') still (wrongly) consider that there it contains 7 players, and yet not publish them when the browser subscribes?

dr-dimitru commented 9 years ago

I belive we need to add cache flush on meteor restart.

No players appear in the browser client at port 3000. This is not logical, since the Meteor.neo4j.collection('players') object on the server still considers that there are 7 players to publish.

How do you check Meteor.neo4j.collection('players') content?

dr-dimitru commented 9 years ago

@blackslate saw mention of console.log(), will came back after testing

dr-dimitru commented 9 years ago

@blackslate please update to v0.9.1, all issues should be solved, please update me after testing on your end, thank you for contribution.

schabluk commented 8 years ago

Hi, I have the same or similar behaviour with v0.9.1. After meteor restart, the Players.find({}).count() returns 0, despite there are 7 nodes in database, so new 7 players are added. Then console (server side) shows 7, but on client I have 14 players. Each restart adds 7 new players.