GoogleCloudPlatform / GoogleCloudPlatform/DataflowTemplates

[Bug]: ISODate serialization truncates millisecond precision

Open
#3,308 2 comments 1 reaction 0 assignees View on GitHub
bug p2
Dominant language
Java
Stars
1.3k
Forks
1.1k
Avg merge
2d 20h
Merged PRs (30d)
60

Description

### Related Template(s)

mongodb_to_bigquery

### Template Version

2026-02-03-00_rc01

### What happened?

I have MongoDB to BigQuery dataflow job.

When there are ISODate (example: `ISODate('2026-02-03T15:31:41.924Z')`) in Mongo documents, then in BigQuery those appear in descriptive (long) format like "Feb 3, 2026, 3:31:41 PM".

This error is related to how "Read Documents" transforms MongoDB Documents to JSON here: https://github.com/GoogleCloudPlatform/DataflowTemplates/blob/main/v2/mongodb-to-googlecloud/src/main/java/com/google/cloud/teleport/v2/transforms/JavascriptDocumentTransformer.java#L150

By default it uses Relaxed JSON mode: https://github.com/mongodb/mongo-java-driver/blob/main/bson/src/main/org/bson/Document.java#L418

Gemini suggested that:
> If JsonWriterSettings aren't explicitly forced to ISO-8601, the MongoDB Java driver defaults to "Relaxed" mode. In this mode, it uses the JVM's default Locale to stringify dates.
Locale.US produces: Feb 3, 2026, 3:31:41 PM
ISO Standard would be: 2026-02-03T15:31:41.924Z

Could someone take a look at this?

### Relevant log output

```shell

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.