Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_publishCursor handle #235

Open
ccorcos opened this issue May 7, 2015 · 1 comment
Open

_publishCursor handle #235

ccorcos opened this issue May 7, 2015 · 1 comment

Comments

@ccorcos
Copy link

ccorcos commented May 7, 2015

I'm looking at the code under the "Advanced Publications" section, specifically the stuff with Mongo.Collection._publishCursor.

It seems that Mongo.Collection._publishCursor will always return undefined rather than a handle that can be stopped...

@ccorcos
Copy link
Author

ccorcos commented May 7, 2015

if I go into the meteor shell and run console.log(Mongo.Collection._publishCursor.toString()), I get this:

I20150506-17:48:49.658(-7)? function (cursor, sub, collection) {                                                // 302
I20150506-17:48:49.658(-7)?   var observeHandle = cursor.observeChanges({                                                                         // 303
I20150506-17:48:49.658(-7)?     added: function (id, fields) {                                                                                    // 304
I20150506-17:48:49.658(-7)?       sub.added(collection, id, fields);                                                                              // 305
I20150506-17:48:49.658(-7)?     },                                                                                                                // 306
I20150506-17:48:49.658(-7)?     changed: function (id, fields) {                                                                                  // 307
I20150506-17:48:49.659(-7)?       sub.changed(collection, id, fields);                                                                            // 308
I20150506-17:48:49.659(-7)?     },                                                                                                                // 309
I20150506-17:48:49.659(-7)?     removed: function (id) {                                                                                          // 310
I20150506-17:48:49.659(-7)?       sub.removed(collection, id);                                                                                    // 311
I20150506-17:48:49.659(-7)?     }                                                                                                                 // 312
I20150506-17:48:49.659(-7)?   });                                                                                                                 // 313
I20150506-17:48:49.659(-7)?                                                                                                                       // 314
I20150506-17:48:49.659(-7)?   // We don't call sub.ready() here: it gets called in livedata_server, after                                         // 315
I20150506-17:48:49.660(-7)?   // possibly calling _publishCursor on multiple returned cursors.                                                    // 316
I20150506-17:48:49.660(-7)?                                                                                                                       // 317
I20150506-17:48:49.660(-7)?   // register stop callback (expects lambda w/ no args).                                                              // 318
I20150506-17:48:49.660(-7)?   sub.onStop(function () {observeHandle.stop();});                                                                    // 319
I20150506-17:48:49.660(-7)? }

So it appears, it does the stopping for you and doesnt return the handle. So the code could use an update.

@tmeasday tmeasday removed their assignment Jan 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants