Great package, rich and simple! But I'm stuck with one small detail...
I'm trying to do some pre-processing before I insert an object into my collections using PUT requests, e.g., using:
collectionApi.addCollection(Classrooms, 'classrooms', {
authToken: undefined,
methods: ['POST','GET','PUT','DELETE'],
before: {
POST: undefined,
GET: undefined,
PUT: insertClassroomHistory,
DELETE: undefined,
}
});
Normally, the insertClassroomHistory function works as advertised, but if I try to insert some data into a different collection (e.g., a log of actions) as part of this pre-processing, the execution stalls, e.g.:
ClassroomHistory = new Meteor.Collection('classroom-history');
insertClassroomHistory = function(collectionID, obj, newValues) {
// ... Do some pre-processing
console.log('Detected classroom state change - instering into history...'+record);
var newId = ClassroomHistory.insert(record,displayResult);
console.log('inserting into classroom history: '+newId);
// ... some other stuff
return true;
}
The second console.log() is never displayed, and the displayResult() callback is never called.
Is this a bug, or a feature? Is there any reason why we should not try to access Meteor Collections from these 'before' functions?
Thanks!
Great package, rich and simple! But I'm stuck with one small detail...
I'm trying to do some pre-processing before I insert an object into my collections using PUT requests, e.g., using:
Normally, the insertClassroomHistory function works as advertised, but if I try to insert some data into a different collection (e.g., a log of actions) as part of this pre-processing, the execution stalls, e.g.:
The second console.log() is never displayed, and the displayResult() callback is never called.
Is this a bug, or a feature? Is there any reason why we should not try to access Meteor Collections from these 'before' functions?
Thanks!