[COMPASS-4879] Filters field in compass allows for entering invalid queries and doesn't warn Created: 10/Jun/21  Updated: 27/Oct/23  Resolved: 24/Nov/22

Status: Closed
Project: Compass
Component/s: Query Bar
Affects Version/s: 1.25.0
Fix Version/s: 1.34.0

Type: Bug Priority: Minor - P4
Reporter: Harshad Dhavale Assignee: Unassigned
Resolution: Gone away Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File Compass_CorrectlySpecifiedQuery.png     PNG File Compass_IncorrectlySpecifiedQuery.png    
Story Points: 3
Documentation Changes: Not Needed

 Description   

In the Compass > Documents Modal > FILTER field, one can enter an invalid query, and Compass does not give any errors. As a result, the results shown are unexpected and inaccurate.

For example, the following query that you specified in the Filter in Compass, qualifies neither as a find query nor as an aggregate query (there is no aggregation pipeline stage named $expr):

{
 $expr: { $gt: [{ $toLong: "$creationDate"}, 20210512000000]}
},
{$group: {
_id: {imsi:"$imsi", oldImei: "$oldImei", imei: "$imei"}, count: {$sum: 1 }
}},
{$match: {
  "count": {$gte : 2 }
}},
{$sort: {
  "count": -1
}}

Yet, when we enter the above query in the "Filter", it does not throw any errors, and returns unexpected and inaccurate results. Please refer the attached screenshot.

Compass should warn users when an erroneous query like the above is entered in the "Filter".

However, entering only the $expr part like the following yields the expected results, because that is correctly formed:

{ $expr: { $gt: [{ $toLong: "$creationDate"}, 20210512000000]} }

Compass should warn users when an erroneous query like the above is entered in the "Filter".


Generated at Wed Feb 07 22:37:43 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.