enter image description here please this error is showing up while i'm trying to update the last_name & first_name of a user any help please ? (i'm using Linux)
please this error is showing up while i'm trying to update the last_name & first_name of a user any help please ? (i'm using Linux) please open the image above to see it clearly
db.contactList.update({ "_id" : ObjectId("6378c0336c5f81777d8bd4a5")} {$set:{"Last_name":"Kefi"}, {"First_name":"Anis"}})); uncaught exception: SyntaxError: missing ) after argument list : @(shell):1:70 db.contactList.update({ "_id" : ObjectId("6378c0336c5f81777d8bd4a5")} {$set:{Last_name:"Kefi"}, {First_name:"Anis"}}); uncaught exception: SyntaxError: missing ) after argument list : @(shell):1:70
CodePudding user response:
Try this:
db.contacts.updateOne(
{
_id: ObjectId('6377ce54ffd3270e15035da7') // id of document you want to update
},
{
$set: {
"Last_name": "Kefi",
"First_name": "Anis"
}
}
);
Make sure you have exact same properties in you schema.
If you want to use update
method then try this:
db.contacts.update(
{
_id: ObjectId('6377ce54ffd3270e15035da7') // id of document you want to update
},
{
$set: {
"Last_name": "Kefi",
"First_name": "Anis"
}
}
);