Hi. After a MongoDB server update from version 4.2 to 7.0, the function int BSONObj::getIntField(const char *name) const does not return the correct integer value for the respective field anymore, but INT_MIN (-2147483647 ). The correct data does exist in the MongoDB database. Wondering if there is an updated version of this function that the legacy code can use instead perhaps?
Snippet of the code:
auto_ptr cursor;
if ( scheme == “id1” || scheme == “id2” )
cursor = cCDSConn.query(“database.table”, BSON(“identifier” << mID ));
if (cursor->more()) {
BSONObj p = cursor->next();
mData = p.getIntField(“data”);//here mData is being set/returned as INT_MIN
}
Any help would be much appreciated!
Kind regards,
C.
Skip to main content
What version of the C++ driver are you using? That sounds like the legacy V1 driver.
Thank you. It must be fairly old since I can see the copyright year as 2009 in all the bson.h , etc, including bson-inl.h where the getIntField() function is defined. I will look into upgrading the C++ driver.
New & Unread Topics
Topic | Replies | Views | Activity |
---|---|---|---|
Multiple databases vs single database | 0 | 598 | Apr 2024 |
Regarding MonogoDB support for serializable isolation level | 0 | 462 | May 2024 |
Index on timestamp fields | 4 | 1.2k | Jun 2024 |
How to mock a DB in order to unit test? | 2 | 2.8k | Jun 2024 |
Darshan Hiranandani : Has anyone tried disabling writeConcern acknowledgment to enhance performance? | 1 | 63 | Aug 2024 |