[SERVER-2725] db.eval exceptions not propagated to client Created: 09/Mar/11  Updated: 14/May/14  Resolved: 10/Mar/11

Status: Closed
Project: Core Server
Component/s: JavaScript
Affects Version/s: 1.8.0-rc1
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Scott Hernandez (Inactive) Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Minor Change
Operating System: ALL
Participants:

 Description   

>db.test1.save({_id:1})
>f = function() {db.test1.update({_id:1}, {_id:2, other:true})}
>db.eval(f)
null
>f()
cannot change _id ....

It seems like the dbeval case should return a doc with the error.



 Comments   
Comment by Eliot Horowitz (Inactive) [ 10/Mar/11 ]

the update done from with the eval doesn't return an error.
you would need to return getLastError()
the shell does it because the shell calls getLastERror automatically after a write

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