Exception in callback of async function: TypeError: callback is not a function

1.9k Views Asked by At

I cant figure out why my insert query code located in server/main.js is causing this: TypeError: callback is not a function error message.

The following code is located at: server/main.js

var businessCard = [{PostedDate: moment().add(0, "days").format('MM/DD/YYYY'), sentBy: currentUserId, recipientName: recipientName }];

Next line is the insert query:

Messages.insert({businessCard: businessCard}, {multi:true});

When I run the code, no inserts into the Messages collection are carried out, neither do I get any error messages in the browser console, however when I check the terminal I see the following error message:

This is the error message I get in the terminal

When I comment out the insert query, the error message disappears, leading me to think there is something wrong in how I have written this insert code.

Kindly help me figure out what am doing wrong here.

Looking forward to your help

1

There are 1 best solutions below

0
On

The error is because you use multi: true option, insert method does not have this option.