Skip to content

MongoDB string field incorrectly inferred as INT during metadata ingestion #38303

Done

Description

@AnaMadrina

Connector

MongoDB Connector

Feature area

Metadata ingestion

Describe the bug

In OpenMetadata 2.0.5, a MongoDB field stored as BSON string is incorrectly registered as INT when its values are numeric-looking strings.

Source: MongoDB view DR_Ccccccc_V01
Field: CODIGO

Example value:

"01051"

Leading zeros are significant because the field represents a municipality code.

Source verification
The BSON type was checked directly on the MongoDB view:

db.DR_Ccccccc_V01.aggregate([
{$group: {_id: {$type: "$CODIGO"}, n: {$sum: 1}}}
])
Result:

{ _id: "string", n: 8137 }
Therefore, all 8,137 records have CODIGO as BSON string.

OpenMetadata result
Sample Data correctly preserves:

"01051"
However, OpenMetadata metadata returns:

"name": "CODIGO",
"dataType": "INT",
"dataTypeDisplay": "int"
and the UI consequently displays:

CODIGO (int)
Expected behavior
The MongoDB BSON type should be preserved:

CODIGO → STRING
instead of being inferred from its numeric-looking content as:

CODIGO → INT
Environment
OpenMetadata: 2.0.5
Connector: MongoDB
Source entity: MongoDB View
This behavior seems potentially related to #32075.

Could you confirm whether this is the same issue and whether it has been fixed or is planned for a future release?

To Reproduce

1. Create a MongoDB collection containing a string field with numeric-looking values and leading zeros, for example:

	{ "CODIGO": "01051" }

2. Create a MongoDB view over that collection preserving the CODIGO field as string.

3. Verify the BSON type in the MongoDB view:

	db.<view_name>.aggregate([ {$group: {_id: {$type: "$CODIGO"}, n: {$sum: 1}}} ])

	The result should report _id: "string".

4. Ingest the MongoDB view into OpenMetadata using the MongoDB connector.

5. Open the ingested entity and check the CODIGO column type.

6. Open Sample Data and compare the value with the column metadata.

Actual result:

    · MongoDB BSON type: string
· Sample Data preserves "01051".
· Column metadata reports dataType: "INT" and dataTypeDisplay: "int".

Expected result:

· CODIGO should be registered as a string type, matching the BSON type in MongoDB.

Expected behavior

A MongoDB field with BSON type string should be ingested as a string type in OpenMetadata, even when its values are numeric-looking strings such as "01051".

The source BSON type should not be re-inferred as INT based on the field content.

Connection / ingestion config

Logs

OS

Windows 11

Python version

OpenMetadata version

2.0.5

OpenMetadata Ingestion package version

Additional context

No response

Pre-submission checklist

  • I searched for duplicate issues.
  • I removed credentials, hostnames, emails, and other sensitive data from logs and config.

Activity

  1. added
    bug
    on Nov 20, 2026
  2. added a commit that references this issue on Nov 24, 2026
    bb072b5
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

    Ingestionbugconnector:other

    Type

    No type

    Projects

    • Status
      Done ✅

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions