[SERVER-37068] aggregation expressions don't accept BSON decimal as numeric type Created: 10/Sep/18  Updated: 29/Oct/23  Resolved: 01/Jul/20

Status: Closed
Project: Core Server
Component/s: Aggregation Framework
Affects Version/s: 4.0.6
Fix Version/s: 4.7.0

Type: Bug Priority: Major - P3
Reporter: Asya Kamsky Assignee: Junhson Jean-Baptiste (Inactive)
Resolution: Fixed Votes: 0
Labels: asya, neweng, query-44-grooming, snp
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Problem/Incident
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Query 2020-06-29, Query 2020-07-13
Participants:
Linked BF Score: 44

 Description   

db.foo.aggregate({$addFields:{x:{$substr:[{$literal:"xxxxxxxx"}, 0, NumberDecimal("5")]}}})
2018-09-10T14:40:15.878-0400 E QUERY    [js] Error: command failed: {
	"ok" : 0,
	"errmsg" : "$substrBytes:  length must be a numeric type (is BSON type decimal)",
	"code" : 16035,
	"codeName" : "Location16035"
} : aggregate failed 
 
// same for other string functions
[js] Error: command failed: {
    "ok" : 0,
    "errmsg" : "$substrBytes:  length must be a numeric type (is BSON type decimal)",
    "code" : 16035,
    "codeName" : "Location16035"
} : aggregate failed :

Decimal should be treated like other numeric types and be valid.



 Comments   
Comment by Githook User [ 01/Jul/20 ]

Author:

{'name': 'Junhson Jean-Baptiste', 'email': 'junhson.jean-baptiste@mongodb.com', 'username': 'junhsonjb'}

Message: SERVER-37068 Add NumberDecimal as numeric type for aggregation expressions
Branch: master
https://github.com/mongodb/mongo/commit/e7e4e0707a1be7ae27a129373f0e00888e9f9aea

Comment by Githook User [ 30/Jun/20 ]

Author:

{'name': 'Kaloian Manassiev', 'email': 'kaloian.manassiev@mongodb.com', 'username': 'kaloianm'}

Message: Revert "SERVER-37068 Add NumberDecimal as numeric type for aggregation expressions"

This reverts commit 603952c4afd0d2f9b0e9cbe35adfbb407419cc7a.
Branch: master
https://github.com/mongodb/mongo/commit/e3304d5987789d71f297801cdc037acda60d3c55

Comment by Githook User [ 29/Jun/20 ]

Author:

{'name': 'Junhson Jean-Baptiste', 'email': 'junhson.jean-baptiste@mongodb.com'}

Message: SERVER-37068 Add NumberDecimal as numeric type for aggregation expressions
Branch: master
https://github.com/mongodb/mongo/commit/603952c4afd0d2f9b0e9cbe35adfbb407419cc7a

Generated at Thu Feb 08 04:44:53 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.