inProgress-team / react-native-meteor

Meteor Reactivity for your React Native application :)
MIT License
693 stars 210 forks source link

Possible bug: Meteor.call callback is not being executed when object id is of type MongoID #218

Open donedgardo opened 7 years ago

donedgardo commented 7 years ago

My data _id schema is of type MongoID instead of the default: see idGeneration Meteor Docs.

This caused all my Meteor method that handled fetching of this collection to never execute its callback in Meteor.call(callback)

My fix was this: (server side)

Meteor.methods({
  getNews: function(newsId){
    check(newsId, String);
    let news =  News.findOne(new Mongo.ObjectID(newsId));
    news._id = news._id.str;
    return news;
  }
});

Before returning the news object, I had to change its id back to string. With this my callback Meteor.call(callback) was executed.

I'm not completely sure, but I think it's related to this package, or Meteor in general. Must investigate further. Any help appreciated.

donedgardo commented 7 years ago

I'm such a noob related #208 Will leave open till merge :)

noris666 commented 7 years ago

@donedgardo why you get data by methods ? :-)

donedgardo commented 7 years ago

@noris666 I understand why this is odd, but in my case I didn't want to open a subscription for this.