[SERVER-1501] Enhance getlasterror to include indication of when $unset, $pull or $pullAll modifier operations do not actually remove data Created: 28/Jul/10  Updated: 07/Mar/14  Resolved: 02/Nov/12

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

Type: Improvement Priority: Minor - P4
Reporter: David Dodd Assignee: Unassigned
Resolution: Duplicate Votes: 2
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-3409 WriteResult should indicate number of... Closed
Participants:

 Description   

getlasterror currently does not include any indication that a modifier operation which should remove data in fact did remove data.

$unset, $pull & $pullAll modifier operations should indicate via getlasterror the modifer had nothing to delete.



 Comments   
Comment by Eliot Horowitz (Inactive) [ 02/Nov/12 ]

Consolidating to SERVER-3409 since it has the most votes.

Comment by David Dodd [ 29/Jul/10 ]

The returned object might be modified look like this...

{
"err" : null,
"updatedExisting" : true,
"n" :

{ "floatApprox" : 0 }

,
"missing_modificand" : [ "{ $pull :

{ field : value_array }

}", "{ $unset :

{ field : 1}

}" ],
"ok" : 1
}

I have realized that the $inc modifier's behaviour when the field does not yet exist would also potentially justify an entry in the missing_modificand array.

An alternative might be...

{
"err" : null,
"updatedExisting" : true,
"n" :

{ "floatApprox" : 0 }

,
"missing_modificand" : [ { "modifier" : "$pull", "modificand": "

{ field : value_array }

" },
{ "modifier" : "$unset", "modificand" : "

{ field : 1 }

" ],
"ok" : 1
}

Generated at Thu Feb 08 02:57:12 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.