[SERVER-20575] $where with invalid syntax returns unfriendly error message Created: 23/Sep/15  Updated: 20/May/16  Resolved: 20/May/16

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

Type: Bug Priority: Major - P3
Reporter: Adam Midvidy Assignee: DO NOT USE - Backlog - Platform Team
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

> db.bar.insert({x:1})
> db.runCommand({find: "bar", filter: {"$where": "INVALID JAVASCRIPT!!!"}})
{
        "waitedMS" : NumberLong(0),
        "ok" : 0,
        "errmsg" : "Failed to call method",
        "code" : 1
}
> db.bar.find({$where: "INVALID JAVASCRIPT!!!!"})
Error: error: {
        "$err" : "Can't canonicalize query: InternalError Failed to call method",
        "code" : 17287
}



 Comments   
Comment by Mira Carey [ 20/May/16 ]

Once we started parsing $where js with SM's Reflect.parse we started offering line and column syntax reporting. This is gone away

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