Reputation: 427
I am new to MongoDB and currently I am learning it. But at a point I got syntax error and I unable to find out that error. So, I need your help.
Code:
let reviewText1: [
"The Martian could have been a sad drama file, instead it was a ",
"hilarious file weith a little bit of dra,a added to it. The Martian is what ",
"everybody wants from a space adventure. Ridley Scott can still make great ",
"movies and this is one of his best."
].join() db.movieDetails.updateOne({
title:"The Martian"
}, {
$push: {
reviews: {
rating: 4.5,
date: ISODate("2016-01-12T09:00:00Z"),
reviewer: "Spencer H.",
text: reviewText1
}
}
})
Error:
2020-02-03T08:29:30.381+0530 E QUERY [js] uncaught exception: SyntaxError: u nexpected token: ':' : @(shell):1:15
Thanks In Advance.
Upvotes: 1
Views: 43
Reputation: 49975
You cannot use colon after variable name in JavaScript, there should be:
let reviewText1 = [
"The Martian could have been a sad drama file, instead it was a ",
"hilarious file weith a little bit of dra,a added to it. The Martian is what ",
"everybody wants from a space adventure. Ridley Scott can still make great ",
"movies and this is one of his best."
].join()
console.log(reviewText1)
Upvotes: 1