inProgress-team / react-native-meteor

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

My _id returned from find seem to have a "-" minus sign at the beginning of them. #185

Open adamgins opened 7 years ago

adamgins commented 7 years ago

After calling a .find() function or using MeteorListView my _ids seem to have a minus - at the front of them ... eg -0b1d8ee2eef26ffbe3b3289f instead of 0b1d8ee2eef26ffbe3b3289f

Anything I am doing or ways to solve this?

spencercarli commented 7 years ago

Hey Adam, just ran into this myself. Found it was happening because of the way I was generating the _id for mongo. I was doing it like so

_id: (new Mongo.ObjectID())._str

I replaced it with the following and it's working fine now (I think)

_id: Random.id()

*Random comes from Meteor

adamgins commented 7 years ago

@spencercarli thanks.

Mmm... I have a large legacy of docs with IDs that were generated using a similar approach new Meteor.Collection.ObjectID()._str, which is what's been documented in best practices... so I expect a lot of Meteor users will have similar issues.

@Mokto @noris666 any thoughts on solving this in the core package, pls?

noris666 commented 7 years ago

Hello @adamgins ! Sorry for the late answer ! Now i prepare application for publishing and also have this issue. Now try to fix this problem. I'll let you know about my results.

adamgins commented 7 years ago

@noris666 thanks.

Diwei-Chen commented 7 years ago

@noris666 Still getting the issue. Did you find a fix?

noris666 commented 7 years ago

@adamgins @Diwei-Chen guys i think this PR https://github.com/inProgress-team/react-native-meteor/pull/208 can fix this problem, if anybody can check, please tell me results.

jackkav commented 7 years ago

It didn't fix the problem for me, but i wrote a hacky fix in a fork of the minimongo-cache just to get login working. Needs someone who knows where this problem is coming from to fix it in a more sensible way. @noris666 @Diwei-Chen #236 https://github.com/jackkav/minimongo-cache/