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 |
---|---|---|---|
Working with timezones and $dateTrunc | 3 | 485 | Apr 2024 |
Why is it that mongodb restarts are slow or even impossible to start when the number of collections is large | 3 | 403 | Jun 2024 |
Populate id that references a nested Object | 0 | 522 | Jun 2024 |
How to use a previous aggregation step to generate the boundaries of a bucket? | 0 | 197 | Jul 2024 |
Fastest way to get total count for pagination, for an aggregation pipeline | 7 | 1.1k | Aug 2024 |