[SERVER-491] BSONObj::getObjectID should be const qualified Created: 16/Dec/09  Updated: 12/Jul/16  Resolved: 16/Dec/09

Status: Closed
Project: Core Server
Component/s: Internal Client
Affects Version/s: 1.2.0
Fix Version/s: 1.3.0

Type: Bug Priority: Minor - P4
Reporter: Ianiv Schweber Assignee: Eliot Horowitz (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

BSONObj::getObjectID is declared as:

bool getObjectID(BSONElement& e);

but it does not change the BSONObj, so just like the rest of the field getters, it should be const:

bool getObjectID(BSONElement& e) const;

That const_cast in my code is looking ugly



 Comments   
Comment by auto [ 16/Dec/09 ]

Author:

{'name': 'Eliot Horowitz', 'email': 'eliot@10gen.com'}

Message: make getObjectid const SERVER-491
http://github.com/mongodb/mongo/commit/cb67dbc196968595bb99613ce2977c8af1c469eb

Generated at Thu Feb 08 02:54:17 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.