meteor-persistent-minimongo2
meteor-persistent-minimongo2 copied to clipboard
Error Triggered on Refresh, Otherwise Fine
The top level error is from simple schema, however the cause is from this package, seemingly from it trying to refresh itself. But I'm unsure why this is an issue
insert failed: Error: The side played by the User. is required
at getErrorObject (http://localhost:3000/packages/aldeed_collection2-core.js?hash=18cc61915c0e22cac3180c5c8c9e0ac91bdd188a:522:15)
at Mongo.Collection.doValidate (http://localhost:3000/packages/aldeed_collection2-core.js?hash=18cc61915c0e22cac3180c5c8c9e0ac91bdd188a:501:13)
at Mongo.Collection.(anonymous function) [as insert] (http://localhost:3000/packages/aldeed_collection2-core.js?hash=18cc61915c0e22cac3180c5c8c9e0ac91bdd188a:259:25)
at http://localhost:3000/packages/frozeman_persistent-minimongo2.js?hash=b744f4b7dd51ccfbd5385483afe4f7c5cc3eea16:2518:55
at http://localhost:3000/packages/frozeman_persistent-minimongo2.js?hash=b744f4b7dd51ccfbd5385483afe4f7c5cc3eea16:477:13
at http://localhost:3000/packages/meteor.js?hash=6d285d84547b3dad9717a7c89c664b61b45ea3d8:1117:22
The code that the error points to:
refresh: function (init) { // 136
var self = this; // 137
self.store.getItem(self.key, function(err, list) { // 138
if(!err) { // 139
// 140
self.list = list || []; // 141
self.stats.added = 0; // 142
// 143
if (!! list) { // 144
var length = list.length; // 145
var count = 0; // 146
var newList = []; // 147
_.each(list, function (id) { // 148
self.store.getItem(self._makeDataKey(id), function(err, doc) { // 149
if(!err) { // 150
if(!! doc) { // 151
var id = doc._id; // 152
var foundDoc = self.col.findOne({_id: id}); // 153
// 154
if(foundDoc) { // 155
delete doc._id; // 156
self.col.update({_id: id}, {$set: doc}); // 157
} else { // 158
id = self.col.insert(doc); // <-- here
} // 160
// 161
newList.push(id); // 162
} // 163
} // 164
count++; // 165
}); // 166
});
And here
function executeCallback(promise, callback) { // 445
if (callback) { // 446
promise.then(function (result) { // 447
callback(null, result); // <-- here
}, function (error) { // 449
callback(error); // 450
}); // 451
} // 452
}