Skip to content

The Mongo scalar map's nativeType holds codec tokens for Json and Bson, not BSON type names #30468

Open

Description

@wmadden-electric

What a maintainer sees. Nothing a user sees is wrong today. Every entry in the Mongo PSL scalar map carries a nativeType, which for most scalars is the BSON type the validator uses (int, long, decimal). For Json it is json and for Bson it is bson: codec tokens, because Json stores several BSON types and Bson any. The PSL interpreter builds a user-facing message from this field for deprecated aliases, "stored as BSON ". No deprecated alias points at Json or Bson today, but a future message built the same way would print "stored as BSON json" or "stored as BSON bson".

Where. mongoScalarAuthoringTypes in packages/3-mongo-target/2-mongo-adapter/src/exports/control.ts; the message in packages/2-mongo-family/2-authoring/contract-psl/src/interpreter.ts; the framework requires nativeType on a type constructor's output (framework-authoring.ts).

Likely fix. In the framework, make nativeType optional for type constructors whose codec declares no single storage type, or add a separate display label, and have messages read the codec's targetTypes instead of nativeType.

Where it came from. #30439.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions