IDE SyntaxError: missing : after property id

Hi all,

I got this error " MongoDB server version: 5.0.3
uncaught exception: SyntaxError: missing : after property id :
@(shell eval):1:62
exiting with code -4" when I query from mongo

mongo -u “${USER}” -p “${PASSWORD}” --eval “db=db.getSiblingDB(‘request-data’).Requests.updateMany({“Company.Email”:{”$exists": true}}, {"$set":{“Company.Email":"test@company.net”}})"

if I type mongo, use request-data and do command: “db.Requests.updateMany({“Company.Email”:{”$exists": true}}, {"$set":{“Company.Email":"test@company.net”}})". it works

Maybe I’m just too tired… any idea?

Regards,

Most likely the $ signs within double quotes are interpreted as a shell variables rather than a MongoDB operator.

The solution is to replace the first and last double quotes of the --eval parameter with single quotes.

2 Likes

it works as well. thanks