BSONObj ReadPreferenceSetting::toBSON() const { BSONObjBuilder bob; bob.append(kModeFieldName, readPreferenceName(pref)); if (tags != defaultTagSetForMode(pref)) { bob.append(kTagsFieldName, tags.getTagBSON()); } return bob.obj(); }
void ReadPreferenceSetting::toInnerBSON(BSONObjBuilder* bob) const { bob->append(kModeFieldName, readPreferenceName(pref)); if (tags != defaultTagSetForMode(pref)) { bob->append(kTagsFieldName, tags.getTagBSON()); } if (maxStalenessSeconds.count() > 0) { bob->append(kMaxStalenessSecondsFieldName, maxStalenessSeconds.count()); } }