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

Field names lost in async callback #230

Open
micahalcorn opened this issue Sep 2, 2017 · 3 comments
Open

Field names lost in async callback #230

micahalcorn opened this issue Sep 2, 2017 · 3 comments

Comments

@micahalcorn
Copy link

I've been using this package for years and love it. I'm upgrading to Meteor 1.5, and I'm running to an issue with asynchronous tasks that are called from update hooks.

fieldNames returns ['foo', 'bar']

MyCollection.after.update(function(userId, doc, fieldNames, modifier, options) {
  console.log(fieldNames);
});

fieldNames returns ['MONGO_OBJECT_REMOVED', 'MONGO_OBJECT_REMOVED']

MyCollection.after.update(function(userId, doc, fieldNames, modifier, options) {
  Meteor.defer(() => {
    console.log(fieldNames);
  });
});

Cloning the argument helps, but it seems inappropriate to reference every variable that will be used in the asynchronous callback.
fns returns ['foo', 'bar']

MyCollection.after.update(function(userId, doc, fieldNames, modifier, options) {
  const fns = [...fieldNames];  

  Meteor.defer(() => {
    console.log(fns);
  });
});

Is anyone else experiencing anything like this or have an idea of what might be happening? Google knows nothing about MONGO_OBJECT_REMOVED.

@zimme
Copy link
Member

zimme commented Sep 4, 2017

Server side or client side?

@micahalcorn
Copy link
Author

@zimme server-side, thx.

@zimme
Copy link
Member

zimme commented Sep 6, 2017

I've tried looking around a bit for this and I can't find any reference to MONGO_OBJECT_REMOVED in either this package, meteor or mongodb node driver.

A reproduction repo would probably help to try and track this down.

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