我正在使用Parse.com Javascript API(Backbone)。
我正在尝试将add
结果Query
(模型数组)转换为 a collection
,但出现此错误:Duplicate id: can't add the same model to a collection twice.
样本:
var GameScore = Parse.Object.extend("GameScore");
// A Collection containing all instances of TestObject.
var TestCollection = Parse.Collection.extend({
model: GameScore
});
var collection = new TestCollection();
var query = new Parse.Query(GameScore);
query.equalTo("playerName", "Dan Stemkoski");
query.find({
success: function(results) {
collection.add(results);
},
error: function(error) {}
});
问题:
是否可以调用忽略重复模型的添加方法?