Brandon Lyon
asked on
How to fix a Mongo typo
Hi,
I'm new to mongodb. How would I fix a typo in an object? I tried this query but it resulted in an error of "Unexpected token ILLEGAL"
I'm new to mongodb. How would I fix a typo in an object? I tried this query but it resulted in an error of "Unexpected token ILLEGAL"
db.mer22.update({_id:12345},{$set{"yDescription":"Candy"}})
To me, it looks like the original problem might have been the quotes around yDescription.
ASKER
If I don't have the quotes around yDescription then the error I get is "SyntaxError: Unexpected token {"
db.mer22.update({_id:12345},{$set{yDescription:"Candy"}})
Since you have a solution, please accept your comment
https://www.experts-exchange.com/questions/28732722/How-to-fix-a-Mongo-typo.html?anchorAnswerId=41014962#a41014962
https://www.experts-exchange.com/questions/28732722/How-to-fix-a-Mongo-typo.html?anchorAnswerId=41014962#a41014962
ASKER
My solution is more of a workaround than an actual solution. It's not even a technically correct solution. Instead of updating a single value, I overwrote all of the values. I'd still like to learn how to update just a single value.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you, that did the trick! I was missing a colon after the set.
ASKER
Open in new window