I'm working through the tutorials in preparations for transitioning my app to the CoreData based SDK.
In the "One to One Relationships" & "One to Many Relationships" tutorials I see that the relationships are defined both ways on StackMob.
Is that necessary?
If not are there any special considerations I need to make in my app where relationships are only defined one way on StackMob?
Using the old SDK I had only defined any of my StackMob relationships one way & my app fetched data on an order that worked with the relationship definitions. I used a persistent CoreData store & my app managed putting all the data retrieved from StackMob into the Core Data store & making the relationship connections it needed.
My app has a lot of cases cases where some "to many" relationships defined on StackMob would return very many objects.
Two cases of this are...
One of my schema objects is a tag with no fields defined other than a name - so I'll call that object Tag & the object the tags apply to TaggedObject. I impose a rule that TaggedObject may have no more than 3 Tags so a 'tags' relationship on TaggedObject returns a manageable list. However in my existing data some Tags are applied to over 100 TaggedObjects & as my data set grows 1000 or more is conceivable. That means retrieving a Tag object with a 'taggedobjects' relationship could have a list of 100 or more (& in the future 1000 or more) taggedobject_ids in the returned JSON.
Yikes! That's some massive bloat in the JSON my app is retrieving & would be a lot more concise if Tags on StackMon didn't know or care what TaggedObjects used them.
The other case is one where the relationships is very much one of owner object & owed objects. In one real world set of data I've been using for development the owner object has just over 2500 owned objects. Again a _lot_ of object ids to return in the JSON. Using the old SDK I actually did away with relationships altogether & gave the owned objects an "owner" field which was an indexed string containing the id of the owner object. In the current development version of my StackMob schema that owner field has been changed to an indexed "to one" relationship. This case gets worse because that same owner object has 3 other owned objects with approximate counts of 1500, 500, & 50 in the sample data I'm using.
Cheers, Pedro Plowman
myFestivalsApp.com - Where your iPhone becomes your ultimate festival guide.
http://myfestivalsapp.com/calendar
http://itunes.apple.com/au/app/myfestivals-app/id477712036?mt=8
http://twitter.com/myFestivalsApp
http://www.facebook.com/myfestivalsapp