Q:

Limitations of Parse.com database-structure

I have a data-structure that looks like the following:
{
    "areaType":"Apps",
    "product":"MyApp",
    "mediaType":"gallery",
    "media":[
                {
                    "file":Parse-File,
                    "description":"A nice image"
                },
                {
                    "file":Parse-File,
                    "description":"Another nice image"
                }
            ]
}

I can see that the parse.com database is based NoSQL(MongoDB), so it would be logical to just nest the images inside of my object, but that just returns and error when i try to insert the files into my database. Wouldn't this be the right approach, or am i supposed to put the images in a relational class, and refer to the images parent, with a Pointer like this?

A:

I haven't tried with PFFiles but you could create an NSArray of NSDictionaries with the NSData's image and its name. Something like this:
NSMutableArray *imagesArray = [[NSMutableArray alloc] init];

PFFile *imageFile1 = [PFFile fileWithName:@"A nice image" data:imageData1];
[imagesArray addObject:imageFile1];

PFFile *imageFile2 = [PFFile fileWithName:@"Another nice image" data:imageData2];
[imagesArray addObject:imageFile2];

[self.media setObject:imagesArray forKey:@"media"];

[self.media saveInBackground];

With that you can retrieve all the data at once.
Despite that, maybe it's a good idea to keep just a relation with references to your images, if each group has many, or if the images are too heavy.
Hope it helps.

