[SERVER-81820] Add NamespaceString and DatabaseName specific append methods to BSONObjBuilder Created: 03/Oct/23  Updated: 23/Jan/24  Resolved: 23/Jan/24

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Matt Broadstone Assignee: Backlog - Service Architecture
Resolution: Won't Fix Votes: 0
Labels: ntdi_releasability
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Service Arch
Participants:
Story Points: 3

 Description   

Instead of serializing database strings explicitly when building BSON docs with BSONObj builder, we should develop the following specific append overrides:

  • append(StringData, DatabaseName, ValidatedTenancyScope)
  • append(StringData, NamespaceString, ValidatedTenancyScope

these methods will internally call the serialization methods, but will allow us to depend on the compiler for remembering to always include a ValidatedTenancyScope

After refactoring existing usages, we also want to ensure it's hard (or impossible) to reintroduce issues in the future (appending namespaces incorrectly). Possible options coult be making it impossible using the API or a clang tidy rules to catch issues, etc.



 Comments   
Comment by Didier Nadeau [ 23/Jan/24 ]

As discussed offline this is not possible because we'd need to link NamespaceString/DatabaseName into base library. Instead we'll work on SERVER-83431 to address the issue. 

Generated at Thu Feb 08 06:47:30 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.