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

1
  • where is Messages defined? is it known to your server code? Commented Jun 23, 2017 at 18:04

1 Answer 1

6

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.