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 proxy setup | 4 | 1.0k | Jul 2024 |
Validate ir resume token Exists before to use in ChangeStreamOptions | 0 | 213 | Jun 2024 |
TTLMonitor is not working,the expired data not delete | 0 | 39 | Oct 2024 |
Query behavior with Cursor and getMore: Inconsistent results and handling new inserts | 0 | 59 | Jan 10 |
TTL Index Deletion Speed is Extremely Slow | 0 | 51 | Mar 8 |