inProgress-team / inProgress-team/react-native-meteor

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

Open
#218 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
688
Forks
200
PR merge metrics
No merged PRs in 30d

Description

My data _id schema is of type MongoID instead of the default: see [idGeneration Meteor Docs](https://docs.meteor.com/api/collections.html).

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)
```javascript
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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.