@@ -4,11 +4,22 @@ assert.strictEqual(ObjectId('0123456789abcdef01234567').tojson(), 'ObjectId("012
44
55assert . strictEqual ( BinData ( 4 , 'abcdefgh' ) . toString ( ) , 'BinData(4,"abcdefgh")' ) ;
66
7- assert . strictEqual ( NumberLong ( 1234567890 ) . toString ( ) , 'NumberLong(1234567890)' ) ;
8- const nl1 = NumberLong ( 9.223372036854776e+18 , 2147483647 , 4294967295 ) ;
9- assert . strictEqual ( nl1 . floatApprox , 9223372036854776000 ) ;
10- assert . strictEqual ( nl1 . top , 2147483647 ) ;
11- assert . strictEqual ( nl1 . bottom , 4294967295 ) ;
12- assert . strictEqual ( nl1 . exactValueString ( ) , "9223372036854775807" ) ;
7+ assert . strictEqual ( NumberLong ( 2147483647 ) . toString ( ) , 'NumberLong(2147483647)' ) ;
8+ assert . strictEqual ( NumberLong ( "2147483648" ) . toString ( ) , 'NumberLong("2147483648")' ) ;
9+ assert . strictEqual ( NumberLong ( - 2147483648 ) . toString ( ) , 'NumberLong(-2147483648)' ) ;
10+ console . log ( NumberLong ( - 2147483649 ) . toString ( ) ) ;
11+ assert . strictEqual ( NumberLong ( - 2147483649 ) . toString ( ) , 'NumberLong("-2147483649")' ) ;
12+ assert . strictEqual ( NumberLong ( 9223372036854775807 ) . toString ( ) , 'NumberLong("9223372036854775807")' ) ;
13+ assert . strictEqual ( NumberLong ( - 9223372036854775808 ) . toString ( ) , 'NumberLong("-9223372036854775808")' ) ;
14+ const maxLong = NumberLong ( 9223372036854775807 , 2147483647 , - 1 ) ;
15+ assert . strictEqual ( maxLong . floatApprox , 9223372036854775807 ) ;
16+ assert . strictEqual ( maxLong . top , 2147483647 ) ;
17+ assert . strictEqual ( maxLong . bottom , - 1 ) ; //mongosh uses signed representation, while old shell uses unsigned
18+ assert . strictEqual ( maxLong . exactValueString , "9223372036854775807" ) ;
19+ const minLong = NumberLong ( - 9223372036854775808 ) ;
20+ assert . strictEqual ( minLong . floatApprox , - 9223372036854776000 ) ;
21+ assert . strictEqual ( minLong . top , - 2147483648 ) ;
22+ assert . strictEqual ( minLong . bottom , 0 ) ;
23+ assert . strictEqual ( minLong . exactValueString , "-9223372036854775808" ) ;
1324const nl2 = NumberLong ( "200" ) ;
14- assert . strictEqual ( nl1 . compare ( nl2 ) , 1 ) ;
25+ assert . strictEqual ( maxLong . compare ( nl2 ) , 1 ) ;
0 commit comments