TLP invariant violation when translating Redis GET to mongosh findOne and partitioning by $type

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Works as Designed
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Environment:
      Debian 12 (Linux 6.5.13-5-pve)
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Problem Statement/Rationale

      TLP invariant violation when translating Redis GET to mongosh findOne and partitioning by $type

      Please be sure to attach relevant logs with any sensitive data redacted.
      How to retrieve logs for: Compass; Shell

      Steps to Reproduce

      In mongosh:   

         db.collectionName.drop();
         db.collectionName.insertOne({ mykey: "hello" });
         db.collectionName.insertOne({ nynnubkc: "hello" });
         db.collectionName.insertOne({ mykey: "hello" });
         db.collectionName.insertOne({ dssplpey: 41788 });

      Execute the TLP queries:

         const original = db.collectionName.findOne({ dssplpey:

      { $exists: true }

      });
         const tlpTrue = db.collectionName.findOne({ dssplpey:

      { $exists: true, $type: "number" }

      });
         const tlpFalse = db.collectionName.findOne({ dssplpey: { $exists: true, $not:

      { $type: "number" }

      } });
         const tlpNull = db.collectionName.findOne({ dssplpey:

      { $exists: false }

      });

      Expected Results

      count(original) == count(tlpTrue) + count(tlpFalse) + count(tlpNull)

      Actual Results

      original = 1, tlpTrue = 1, tlpFalse = 0, tlpNull = 1, so partitionSum = 2 ≠ 1. tlpNull returns 

      { mykey: "hello" }

       (no dssplpey), breaking the invariant.

      Additional Notes

      Any additional information that may be useful to include.

            Assignee:
            Chris Kelly
            Reporter:
            HaoGang Mao
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: