summaryrefslogtreecommitdiff
path: root/buildscripts/idl
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2017-07-18 17:03:44 -0400
committerMathias Stearn <mathias@10gen.com>2017-07-26 15:13:34 -0400
commit097323290ad65471cce8b0dabc8ba44a57536dd4 (patch)
tree29d16b0383c0dd89e547176d0cf81e148cec9103 /buildscripts/idl
parent84ef4754b61003c63a480ac009fe2302970b00c9 (diff)
downloadmongo-097323290ad65471cce8b0dabc8ba44a57536dd4.tar.gz
SERVER-30193 Remove OP_MSG default for $db
Diffstat (limited to 'buildscripts/idl')
-rw-r--r--buildscripts/idl/idl/binder.py1
-rw-r--r--buildscripts/idl/idl/generator.py10
2 files changed, 8 insertions, 3 deletions
diff --git a/buildscripts/idl/idl/binder.py b/buildscripts/idl/idl/binder.py
index 5733ec5e682..31c21e636bb 100644
--- a/buildscripts/idl/idl/binder.py
+++ b/buildscripts/idl/idl/binder.py
@@ -298,7 +298,6 @@ def _inject_hidden_command_fields(command):
db_field = syntax.Field(command.file_name, command.line, command.column)
db_field.name = "$db"
db_field.type = "string" # This comes from basic_types.idl
- db_field.default = 'IDLParserErrorContext::kOpMsgDollarDBDefault.toString()' # Default to admin database
db_field.cpp_name = "dbName"
db_field.serialize_op_msg_request_only = True
diff --git a/buildscripts/idl/idl/generator.py b/buildscripts/idl/idl/generator.py
index f75388ed90a..3a818f21672 100644
--- a/buildscripts/idl/idl/generator.py
+++ b/buildscripts/idl/idl/generator.py
@@ -834,14 +834,20 @@ class _CppSourceFileWriter(_CppFileWriterBase):
initializers = ['_%s(std::move(%s))' % (arg.name, arg.name) for arg in constructor.args]
+ initializes_db_name = False
if [arg for arg in constructor.args if arg.name == 'nss']:
- initializers += ['_dbName(nss.db().toString())']
+ initializers.append('_dbName(nss.db().toString())')
+ initializes_db_name = True
initializers += [
'%s(false)' % _get_has_field_member_name(field) for field in struct.fields
- if _is_required_serializer_field(field)
+ if _is_required_serializer_field(field) and not (field.name == "$db" and
+ initializes_db_name)
]
+ if initializes_db_name:
+ initializers.append('_hasDbName(true)')
+
initializers_str = ''
if initializers:
initializers_str = ': ' + ', '.join(initializers)