[SERVER-67822] [CQF] Querying for a field inserted as NumberInt(int) incorrectly returns a double (JS) Created: 06/Jul/22  Updated: 27/Oct/23  Resolved: 11/Aug/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Emily Wang (Inactive) Assignee: Backlog - Query Optimization
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Query Optimization
Participants:

 Description   

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.

 



 Comments   
Comment by Emily Wang (Inactive) [ 11/Aug/22 ]

Oops this is my bad – I can't remember for what reason why I wouldn't have tried running this with classic first. But I am also definitely getting the same thing in classic as in Bonsai, so this should be a non-issue.

hana.pearlman@mongodb.com this came from a type_bracket.js test I tried. 

Comment by Emily Wang (Inactive) [ 07/Jul/22 ]

kyle.suarez@mongodb.com Excuse my JavaScript skills - just edited the ticket!

Comment by Kyle Suarez [ 07/Jul/22 ]

emily.wang@mongodb.com, I am assuming the language used here is JavaScript? I think that means that "plain 3" is actually of type double.

Generated at Thu Feb 08 06:09:09 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.