[DOCS-7599] Why does $set work differently with upsert? Created: 07/Apr/16  Updated: 30/Oct/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: node Assignee: Unassigned
Resolution: Won't Do Votes: 0
Labels: collector-298ba4e7
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

mongo:3.2.0 - your official docker image

Location: https://docs.mongodb.org/manual/reference/operator/update/set/#up._S_set
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:44.0) Gecko/20100101 Firefox/44.0
Screen Resolution: 1366 x 768
repo: docs
source: reference/operator/update/set


Participants:
Days since reply: 1 year, 14 weeks, 2 days ago
Epic Link: DOCSP-1769

 Description   

db.products.update(
   { _id: 100 },
   { $set:
      {
        "tags.1": "rain gear",
        "ratings.0.rating": 2
      }
   },
   { upsert: true }
)

why with upsert option which perform insert operation in my case, getting different result?

{ "_id" : 100, "tags" : { "1" : "rain gear" }, "ratings" : { "0" : { "rating" : 2 } } }



 Comments   
Comment by Education Bot [ 31/Oct/22 ]

Hello! This ticket has been closed due to inactivity. If you believe this ticket is still important, please reopen it and leave a comment to explain why. Thank you!

Generated at Thu Feb 08 07:54:36 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.