[SERVER-58772] improve error message for top level $not expression Created: 22/Jul/21  Updated: 29/Oct/23  Resolved: 21/Oct/21

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

Type: Improvement Priority: Major - P3
Reporter: Asya Kamsky Assignee: Matt Boros
Resolution: Fixed Votes: 0
Labels: neweng, quick-tech-debt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-1454 Use $not as a top-level logical op Backlog
Backwards Compatibility: Fully Compatible
Sprint: QO 2021-11-01
Participants:

 Description   

In 4.4 and earlier, the error message for top level `$not` was:

"errmsg" : "unknown top level operator: $not"

Unfortunately in 5.0 it became possibly more confusing:

"unknown top level operator: $not. If you have a field name that starts with a '$' symbol, consider using $getField or $setField."

I propose we special case the error when $not is used as top level operator to instead add:
"unknown top level operator: $not. If you are trying to negate entire expression use $nor



 Comments   
Comment by Githook User [ 20/Oct/21 ]

Author:

{'name': 'Matt Boros', 'email': 'matt.boros@mongodb.com'}

Message: SERVER-58772: Improve error message for top level $not expression
Branch: master
https://github.com/mongodb/mongo/commit/33bdeafc421ba379294db1d695d5f8a96e9c39be

Comment by Joe Kanaan [ 29/Jul/21 ]

Even if SERVER-1454 is implemented, we could look into doing this for the 5.0 branch

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