My attempt to insert a record into a MongoDB from a Meteor app is failing.
Here is my HTML/Template:
Add a Job/Location
Log In
Designation for Job/Location
Save Job/Location
Here is the client-side JavaScript:
Template.addJobLoc.events({
'click #btnSaveJobLoc': function(event, template) {
var username = Session.get("username");
var jobloc = template.find('#textJobLoc').value;
Meteor.call('insertJobLocation', username, jobloc, function(err) {
if (err) {
Session.set("lastErrMsg", err.message);
} else {
alert(jobloc + ' inserted');
$('#textJobLoc').val("");
$('#textJobLoc').focus();
} // else
}); // Meteor call
} // submit form event
});
And here is the server-side JavaScript (in a .js file of my project’s server folder)
Meteor.methods({
'insertJobLocation': function(username, jobLoc) {
JobLocations.insert({
jl_username: username,
jl_jobloc: jobLoc,
jl_created_by: Meteor.userId()
});
},
Stepping through the code in CDT, I see that the “if (err)” block equates to true, and the error message is “Internal Server Error [500]”:

I know that “500” is a pretty common and general err msg, but what in my code could be causing this?