ostrio-Neo4jreactivity
ostrio-Neo4jreactivity copied to clipboard
Meteor.neo4j.collection('players') and the Neo4j browser on port 7474 disagree about the contents of the database
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.
-
I run the application. 7 "players" are created.
-
I delete all 7 players.
-
I check in the Neo4j browser on port 7474 that all seven have been deleted:
MATCH (p:Player) RETURN p // (no rows)
-
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())
-
I stop Meteor and restart it.
-
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.
-
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. -
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.
- In the Terminal, I see
-
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?