[SERVER-4204] getLastError should return the number of rows affected Created: 03/Nov/11  Updated: 03/Nov/11  Resolved: 03/Nov/11

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Chris Westin Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

This can be an important indicator of whether or not some action needs to be taken by a client program if the result differs from expectations.



 Comments   
Comment by Scott Hernandez (Inactive) [ 03/Nov/11 ]

It already does this:

>db.test1.update({}, {$set:{a:1}}, true, true)
>db.getLastErrorObj()

{ "updatedExisting" : true, "n" : 2, "connectionId" : 1, "err" : null, "ok" : 1 } > db.test1.remove() > db.getLastErrorObj() { "n" : 2, "connectionId" : 1, "err" : null, "ok" : 1 }

See http://www.mongodb.org/display/DOCS/Updating#Updating-CheckingtheOutcomeofanUpdateRequest

Generated at Thu Feb 08 03:05:16 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.