[DOCS-16061] update documention wrong Created: 22/Apr/23  Updated: 30/Oct/23  Resolved: 05/May/23

Status: Closed
Project: Documentation
Component/s: manual, Server
Affects Version/s: None
Fix Version/s: Server_Docs_20231030

Type: Bug Priority: Major - P3
Reporter: Ma__rk Niel__sen Assignee: Jason Price
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

mongo 6, maybe earlier


Participants:
Days since reply: 41 weeks, 4 days ago

 Description   

at https://www.mongodb.com/docs/manual/reference/method/db.collection.update/

where it mentions

For example, the following update sets the upsert option to true:
 

db.books.update(
{ item: "ZZZ135" }

, // Query parameter

{ // Replacement document| |item: "ZZZ135",| |stock: 5,| |tags: [ "database" ]| |}

,

{ upsert: true }

// Options

 

 

 

does not work

db.testdoc.update({person : "john2"}, {person : "john2", color: "blue", pencils : 21}} , {upsert: true });

 

does work
db.testdoc.update({person : "john2"}, {$set :

color: Color value is invalid

} , {upsert: true });



 Comments   
Comment by Ma__rk Niel__sen [ 22/Apr/23 ]

Its not letting me copy to command. Let me change it. 

 

db.testdoc.update({person : "john2"}, {$set :

{color2: "blue", pencils : 21}

} , {upsert: true });

Comment by Ma__rk Niel__sen [ 22/Apr/23 ]

sorry, this works using $set

 

db.testdoc.update({person : "john2"}, {$set :

color: Color value is invalid

} , {upsert: true });

Generated at Thu Feb 08 08:14:29 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.