Uploaded image for project: 'Hibernate ODM'
  1. Hibernate ODM
  2. HIBERNATE-74

null/missing field comparison MQL translation

    • Type: Icon: New Feature New Feature
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      In https://jira.mongodb.org/browse/HIBERNATE-62, we focus on non-null fields. This ticket complements with it to tackle the following two cases:

      • comparison with existing field with `null` value explicitly
      • comparison with missing field

      Note that this ticket is different from https://jira.mongodb.org/browse/HIBERNATE-71, which focuses on `is null` (`is not null`) predicate which returns boolean value, in the sense that this ticket will focus on explicit comparison like`= null` (`!= null`).

       

      Since Hibernate v6.3 (see https://hibernate.atlassian.net/browse/HHH-16843), Hibernate will interpret such nullness comparison as returning `null` value, as per the ternary behaviour of `null`. However, in context a predicate is required (e.g. where clause), null value will be treated as false.

      see https://docs.jboss.org/hibernate/orm/6.6/querylanguage/html_single/Hibernate_Query_Language.html#null-values-and-ternary-logic for null's ternary logic.

       

      Also note that MongoDB's comparison operator treats null and missing fields in the same way (see https://www.mongodb.com/docs/manual/reference/bson-type-comparison-order/#non-existent-fields), so this ticket won't depend on https://jira.mongodb.org/browse/HIBERNATE-48.

       

      Addressing the source code notes tagged with TODO-HIBERNATE-74 is in scope of this ticket.

            Assignee:
            Unassigned Unassigned
            Reporter:
            nathan.xu@mongodb.com Nathan Xu
            None
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: