Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialVincent Jardel
6,436 PointsParse.com to Mongodb migration: PFRelation doesn't work
I succeeded to migrate my app database, but my Xcode code doesn't work with the new database automatically migrated. On parse db, I had table "User" with "friends" relationship.
When I migrated Parse data to Heroku with MongoLab, I have a joined table "friends:_User"
But when I log on simulator:
self.currentUser = [PFUser currentUser];
self.friendsRelation = [[PFUser currentUser] objectForKey:@"friends"];
NSLog(@"%@", self.currentUser);
NSLog(@"%@", self.friendsRelation);
friendsRelation (PFRelation) returns null:
2016-02-28 23:29:21.785 ChillN[4281:59046] <PFUser: 0x7fa43c09ed20, objectId: MZdPHaqByR, localId: (null)> { phone = "000000"; surname = a; username = a; }
2016-02-28 23:29:21.786 ChillN[4281:59046] (null)
That works as expected with Parse, so how can I change this without changing my code? Is it possible? if this isn't the case, what I've to change in my code?
Vincent Jardel
6,436 PointsVincent Jardel
6,436 PointsJust change:
self.friendsRelation = [[PFUser currentUser] objectForKey:@"friends"];
to
self.friendsRelation = [[PFUser currentUser] relationForKey:@"friends"];