|
Actually I was wrong about the behavior here. The redact parameter of the coerceToString only applies to the Status it generates on failure, not its payload. I didn't see this until I wrote a test for it, so we can commit the test to make sure it stays true. But some other improvements came out of the investigation. SERVER-63627, SERVER-63628.
|
if not cls.override_set:
|
with self._block('Status %s::set(const BSONElement& newValueElement) {' % (cls.name),
|
'}'):
|
self._writer.write_line('auto swValue = coerceToString(newValueElement, %s);' %
|
('true' if param.redact else 'false'))
|
with self._predicate('!swValue.isOK()'):
|
self._writer.write_line('return swValue.getStatus();')
|
self._writer.write_line('return setFromString(swValue.getValue());')
|
self.write_empty_line()
|
I believe the coerce statement should just always say false for the redact parameter.
auto swValue = coerceToString(newValueElement, false);
|
redaction is an output operation, not an input operation.
|