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 |
---|---|---|---|
Compound multikey index not used in sort and range query | 1 | 584 | Aug 2024 |
How to Efficiently Rename a Field Across 1 Million MongoDB Documents? | 1 | 676 | Jul 2024 |
Help me creating indexes properly | 1 | 49 | Oct 2024 |
TTLMonitor is not working,the expired data not delete | 0 | 35 | Oct 2024 |
Slow lookup with everything indexed | 2 | 21 | Mar 6 |