sgodbillon / reactivemongo-tailablecursor-demo

Tailable Cursors through WebSockets with ReactiveMongo and Play 2.0
62 stars 21 forks source link

Unable to run demo #1

Closed alexanderjarvis closed 12 years ago

alexanderjarvis commented 12 years ago

Hi Stephane,

Unfortunately, I get the following error in my console when I go to http://localhost:9000/ or /watchCollection

[error] MongoDBSystem - The entire node set is unreachable, is there a network problem?
[error] MongoDBSystem - The entire node set is unreachable, is there a network problem?

Also, I had to create the capped collection in the mongo shell like:

$ use demo
$ db.createCollection("acappedcollection", {capped:true, size:100000})

Otherwise, I got the following error in mongod:

Thu Sep  6 15:30:08 [conn2] assertion 13051 tailable cursor requested on non capped collection ns:demo.acappedcollection query:{}
Thu Sep  6 15:30:08 [conn2] problem detected during query over demo.acappedcollection : { $err: "tailable cursor requested on non capped collection", code: 13051 }

edit: I just tried using play run (instead of start) and it works, but still has the same error as above (is there a network problem?).

sgodbillon commented 12 years ago

Hi Alexander,

First, thank you for your report :)

The log in error may happen when ReactiveMongo is initializing (it receives a request from the app before it has successfully reached the servers), but it should not be a real problem since it will discover the servers some milliseconds after (ReactiveMongo has a default failover for requests, it tries 5 times before giving up, waiting 500 ms before each retry). I guess I have to make the log more clear. It does not work at all for you?

There should not be any difference between run and start, I just tried and it works fine. What version/commit of play are you using?

The demo does not create a capped collection by itself. I think I will implement it very soon since you're the second person to ask me about this problem :)

alexanderjarvis commented 12 years ago

Ah, so it is too quick to think it cannot connect! It does work, but only when I use run. Start does not work at all, which is really strange.

The reconnect logic will be praised I'm sure, as other Mongo plugins don't do this and force an app restart :/

I cloned the master of Play yesterday: https://github.com/playframework/Play20/commit/a6287e1e7ee4e8609a3814859341de4971bf801c

I think that it's good if the demo doesn't require someone to add the capped collection manually, although the logs made this obvious.

Really looking forward to integrating with this project soon :)

mccormicka commented 12 years ago

Hi i was just wondering what is this demo supposed to demonstrate? I have setup a demo db using mongo i go to localhost and enter a test article. In another browser i have localhost pointing to /watchCollection but nothing ever appears. Should the added articles appear in the watchCollection view?

sgodbillon commented 12 years ago

Hi,

It demonstrates ReactiveMongo streaming capabilities.

I have updated the demo so that it creates a capped collection if it does not exist. Now it works out of the box, without having to create the capped collection manually ;)