I have a collection to which I need to post several items in a for loop. Here is code for that:
for(i = 0; i < 28; i++) {
var request = $http({
method: "post",
url: "/students",
data: {
studentName: "Student",
answerImage: "image",
questionPrompt: 1
}
}).then(function successCallback(response) {
}, function errorCallback(response) {
console.log(response);
});
}
When I search the collection, it only posted 23 items. I have cleared my collection and tried this several times and each time it posts only 20-23 items. All the fields for the data are fine. This is the error response I get on the console:
Object {data: null, status: -1, config: Object, statusText: ""}
I am not sure what to do from here. In my real app, I would need to post something like ~200 items to this collection in this for loop. Is it a timing out issue?
Thanks!