Link or pointer?

If I have a class called Article , and I want to add an Author column (which is a type of the User class), should I use a relation or pointer? There can be only one Author , but Author can write many articles. I accept the pointer, but just made sure.

enter image description here

Thanks!

+8
source share
2 answers

If you assume that the article will have 1 or 0 authors, then use a pointer. If there can be several authors, use an array.

When you have a one-to-many relationship, you have the choice of using arrays or PFRelations. Arrays are much easier to handle if the maximum number of records is small, say 100 or less. Perhaps the most important benefit is that you can use includeKey in your query to enter all related objects with a single query.

If the number of related objects is large, you should use PFRelation.

+15
source share

A general rule is to use a one-to-one or one-to-many relationship pointer. Use a relationship when you have a many-to-many relationship. I would say that in your case it looks like you want to use a pointer type. This guide is helpful.

0
source share

All Articles