Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-67822

[CQF] Querying for a field inserted as NumberInt(int) incorrectly returns a double (JS)

    • Type: Icon: Task Task
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Query Optimization

      This is specific to Bonsai and not an issue with the classic optimizer. If we query:

      t.insert([
         {_id: 1, a: NumberInt(3)}, 
         {_id: 2, a: NumberLong(1)}, 
         {_id: 3, a: NumberDecimal("2.0")}
      ]);
      results = t.find({a: {$gt: 0}}).toArray();

      Then the classic engine results and the expected results are:

       

      expected=[ 
         { "_id" : 1, "a" : NumberInt(3) },
         { "_id" : 2, "a" : NumberLong(1) },
         { "_id" : 3, "a" : NumberDecimal("2.0") }, 
      ]; 

      But the actual results from Bonsai are:

       

       

      actual=[
         { "_id" : 1, "a" : 3 },
         { "_id" : 2, "a" : NumberLong(1) },
         { "_id" : 3, "a" : NumberDecimal("2.0") },
      ];

      This seems to only be an issue with NumberInt, as NumberLong and NumberDecimal are returned correctly.

       

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            emily.wang@mongodb.com Emily Wang (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: