Search code examples
javascriptbackbone.jsparse-platform

What is the counterpart of a backbone model in parse?


I am trying to build a simple answer rating app (similar to the canonical Todo app) in Parse.

In Backbone, I could create a Model to represent a single answer and a Collection to represent a list of answers.

If I create a class in Parse's data browser, it corresponds to a Collection in Backbone. How can I specify a model (Parse.Model) in Parse.Collection if I have no way of creating one?


Solution

  • In Parse 1.2.13 (< 1.6), you can use the name of the class created in Parse Data Browser as the name of the model (individual item) in your js code.

    That is, if you create a class named "Widget" in Parse Data Browser, you can use this in your js code:

    var Widget = Parse.Object.extend ("Widget");
    var Widgets = Parse.Collection.extend ({
        model: Widget
    }); // example collection
    

    and proceed as usual with Backbone code.