[DOCS-6572] Clarify documentation for the 'n' value of the result from update Created: 10/Nov/15  Updated: 30/Oct/23  Resolved: 01/Nov/22

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

Type: Improvement Priority: Minor - P4
Reporter: Kaloian Manassiev Assignee: Kay Kim (Inactive)
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

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

 Description   

The documentation for the output of update is incomplete about the value of update.n.

In particular, the value of update.n will also include any upserted documents in addition to documents, which were matched.

Here is the actual value from upserting into an empty collection:

MongoDB shell version: 3.2.0-rc2-97-g243188c
connecting to: test
> use Test;
switched to db Test
> var res = db.runCommand({ update: 'TestColl', updates: [ { q: { _id: 1 }, u: { _id: 1, value: 5 }, upsert: true } ] });
> res
{
        "ok" : 1,
        "nModified" : 0,
        "n" : 1,
        "upserted" : [
                {
                        "index" : 0,
                        "_id" : 1
                }
        ]
}



 Comments   
Comment by Education Bot [ 01/Nov/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:52:34 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.