|
The DocumentSourceMerge struct contains a custom MergeTargetNss struct, which is made up of a db and collection name (stored separately). This object has custom serializer and deserializer methods which should follow the same rules for serialization and deserialization as NamespaceString and DatabaseName do.
To make the deserializer tenant aware:
- Change the "type" for the "db" field in NamespaceSpec to be database_name instead.
- Add the option `deserialize_with_tenant: true` to the MergeTargetNss struct (see namespacestring and/or database_name in basic_types.idl for an example of how it's used already).
- Add `boost::optional<TenantId> as the first parameter to mergeTargetNssParseFromBSON. Then, pass this tenantId to the IDLParserContext that's passed to NamespaceSpec::parse (see
MutableOplogEntry::parse for an example).
- We'll need to pass a tenantId to the IDLParserContext for DocumentSourceMergeSpec as well - use the tenantId that's on the defaultDb parameter for parseMergeSpecAndResolveTargetNamespace (the tenantIds shouldn't change).
- DocumentSourceGraphLookup and DocumentSourceLookup use NamespaceSpec::parse(), we'll want to pass the tenantId at these call sites as well. Similar steps can be followed.
To make the serialization tenant aware:
Change mergeTargetNssSerializeToBSON to use DatabaseNameUtil::serialize for the dbName, rather than call targetNss.dbName().db() directly.
|