问题描述
有人可以提供一个示例,说明如何通过RESTApi为包含其他相关对象集合的对象保存parse.com对象吗?
Can someone please provide an example of how to save a parse.com object via the RESTApi for an object that contains a collection of other related objects?
因此,对象A包含对象B的列表,其中B是预先存在的对象.
so object A contains a list of object B where B is a pre-existing object.
推荐答案
您可以添加如下相关对象:
You can add a related object like this:
{
"__type": "Pointer",
"className": "GameScore",
"objectId": "Ed1nuqPvc"
}
来源: https://www.parse.com/docs/rest#objects-类型
但是,不建议在单个实例中存储大量数据.
However, it's not recommended to store a large amount of data in a single instance.
来源: https://www.parse.com/docs/ios_guide# objects-types/iOS
您最好创建一个链接表,例如如果用户"(A)有很多帐户/汽车/对象"(B),则创建一个表userObject
并使用该表链接其他两个表.
You might be better to create a linked table, e.g. if a 'User' (A) has many a 'Accounts/cars/objects' (B) then create a table userObject
and use that to link the two other tables.
这篇关于Parse.com使用嵌套或相关对象创建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!