[SERVER-13682] NumberLong can't be created from NumberLong/Int Created: 22/Apr/14  Updated: 26/Oct/21  Resolved: 26/Oct/21

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

Type: Bug Priority: Minor - P4
Reporter: Scott Hernandez (Inactive) Assignee: DO NOT USE - Backlog - Platform Team
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

> NumberLong( NumberLong(1) );
2014-04-22T16:27:57.206-0400 Error: could not convert "NumberLong(1)" to NumberLong
> NumberLong( NumberInt(1) );
2014-04-22T16:27:57.206-0400 Error: could not convert "NumberInt(1)" to NumberLong

NumberInt works with itself... and NumberLong.



 Comments   
Comment by Geert Bosch [ 26/Oct/21 ]

In the new mongosh, behavior is consistent:

test> NumberInt(NumberInt(3))
MongoshInvalidInputError: [COMMON-10001] Argument at position 0 must be of type string or number, got object instead (NumberInt)
test> NumberLong(NumberInt(3))
MongoshInvalidInputError: [COMMON-10001] Argument at position 0 must be of type string or number, got object instead (NumberLong)

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