Relation

Parse. Relation

Creates a new Relation for the given parent object and key. This constructor should rarely be used directly, but rather created by Parse.Object.relation.

A class that is used to access all of the children of a many-to-many relationship. Each instance of Parse.Relation is associated with a particular parent object and key.

Constructor

new Relation(parent, key)

Parameters:
Name Type Description
parent Parse.Object

The parent of this relation.

key string

The key for this relation on the parent.

Methods

add(objects) → {Parse.Object}

Adds a Parse.Object or an array of Parse.Objects to the relation.

Parameters:
Name Type Description
objects Parse.Object | Array

The item or items to add.

Returns:
Type:
Parse.Object

The parent of the relation.

query() → {Parse.Query}

Returns a Parse.Query that is limited to objects in this relation.

Returns:
Type:
Parse.Query

Relation Query

remove(objects)

Removes a Parse.Object or an array of Parse.Objects from this relation.

Parameters:
Name Type Description
objects Parse.Object | Array

The item or items to remove.

toJSON() → {object}

Returns a JSON version of the object suitable for saving to disk.

Returns:
Type:
object

JSON representation of Relation