4

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

SirBT
  • 1,580
  • 5
  • 22
  • 51

1 Answers1

6

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

kkkkkkk
  • 7,628
  • 2
  • 18
  • 31