Issue description
We have identified an issue affecting the SQL Interface (Atlas and Enterprise Advanced). The issue can produce incorrect results when SQL queries with a WHERE clause contain an OR condition that evaluates to UNKNOWN.
This applies only to customers actively using the SQL Interface. Customers using the legacy BI Connector are not impacted.
EA SQL Customers: The MongoDB JDBC driver version 3.0.5 and the ODBC driver version 2.0.4 already address the issue.
MongoDB Atlas Customers: The Atlas SQL interface already has been upgraded to a version addressing the issue.
Impact
This issue will only manifest if ALL of the following are true:
The datasource queried contains a nullable field. It can be a simple datasource (collection, array or derived table) or a compound datasource (Join, Unwind or Flatten);
The datasource queried contains
NULLor missing values for the nullable field; andThe SQL query, either hand-written or generated by a BI tool:
Contains a
WHEREclause with anORcondition;One predicate of the
ORcondition evaluates toTRUE; andThe other predicate resolves to
UNKNOWNwhen the nullable field from the datasource evaluates toUNKNOWN(NULLorMISSING).
Rows for which all of the above conditions are met are incorrectly evaluated as UNKNOWN instead of TRUE. This causes these rows to be incorrectly missing from the result set.
Fixes and remediation
If your use case meets the above criteria, MongoDB recommends:
EA SQL users only (Atlas SQL users automatically received this fix)
Upgrade to the latest version of the JDBC or ODBC driver with the fix.
All users
Refresh impacted dashboards.
Update results by re-executing impacted SQL queries.
Additionally, MongoDB recommends that if customers are uncertain whether they meet all issue criteria, that they apply the same steps for any dashboard or SQL query using an OR filter.
For more information, see SQL-3041. If you have any questions, open a support case or start a chat with the MongoDB Support team.