[SERVER-11135] BSONObjBuilder.appendNumber(numeric_limits<long long>::min()) results in 0 value Created: 11/Oct/13  Updated: 11/Jul/16  Resolved: 12/Nov/13

Status: Closed
Project: Core Server
Component/s: Internal Code, Write Ops
Affects Version/s: None
Fix Version/s: 2.5.4

Type: Bug Priority: Critical - P2
Reporter: Scott Hernandez (Inactive) Assignee: Benety Goh
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-11136 Support json parsing of NumberLong/Int Closed
Operating System: ALL
Participants:

 Description   

Adding this to jsobjtests.cpp shows the error.

        class AppendNumberLongMin {
        public:
            void run() {
                BSONObjBuilder b;
                b.appendNumber("a", std::numeric_limits<long long>::min());
                BSONObj o1 = b.obj();
 
                BSONObj o2 = BSON("a" << std::numeric_limits<long long>::min());
 
                ASSERT_EQUALS(o1, o2);
            }
        };

Output:

JsobjTests::BSONObjTests::AppendNumberLongMin	Expected o1 == o2 ({ a: 0 } == { a: -9223372036854775808 }) @src/mongo/dbtests/jsobjtests.cpp:567
 



 Comments   
Comment by auto [ 12/Nov/13 ]

Author:

{u'username': u'benety', u'name': u'Benety Goh', u'email': u'benety@mongodb.com'}

Message: SERVER-11136 SERVER-11135 support NumberLong() in BSONElement::jsonString() result
Branch: master
https://github.com/mongodb/mongo/commit/b7434b66409c8d4515b94d3d7e647cf68b2c46ec

Comment by Scott Hernandez (Inactive) [ 06/Nov/13 ]

Yes, I believe we can. We will need to enable and test of course.

Comment by Benety Goh [ 06/Nov/13 ]

similar comment in src/mongo//dbtests/jsontests.cpp:
"TODO: Enable when SERVER-11135 fixed"

Comment by Eric Milkie [ 06/Nov/13 ]

Can we now re-enable the commented-out code in jsobj.cpp?
" TODO: Enable when SERVER-11135 fixed"

Comment by auto [ 21/Oct/13 ]

Author:

{u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@10gen.com'}

Message: SERVER-11135 Fix C++11 build break and questionable type narrowing.
Branch: master
https://github.com/mongodb/mongo/commit/4f1e7a20d981612ff48a1f42499d6275dc864466

Comment by auto [ 21/Oct/13 ]

Author:

{u'username': u'benety', u'name': u'Benety Goh', u'email': u'benety@mongodb.com'}

Message: SERVER-11135 fixed appendNumber(long long) and appendIntOrLL to handle std::numeric_limits<long long>::min()
Branch: master
https://github.com/mongodb/mongo/commit/b67de10c6307468636b91fddd5d67b066f86b526

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