meteor-restivus
meteor-restivus copied to clipboard
Cannot get all records from a collection..
I can retrieve a single record but when I try to get all records I get the following error... { "error": "internal-server-error", "reason": "Internal server error" }
Here is the code that errors,,,
Api.addRoute('allGuests', {authRequired: false}, {
get: function () {
var records = Guests.find({});
if(records != null) {
console.log(records);
return records;
}
}
});
I also tried Guests.find({}).fetch();
This code works for one record... Api.addRoute('guests/:id', {authRequired: false}, { get: function () { var record = Guests.findOne(this.urlParams.id); if(record != null) { return record; } } });
I seems like my collection was too big and it was running out of memory. i tried a smaller colection and it worked.